- Home /
Question by
steve-o616 · Dec 09, 2016 at 05:08 PM ·
physicsforcesaddexplosionforce
AddExplosionForce Shoots Too High
Hey
Building a basic golf sim I used a AddForceExplosion on the club, so that when it collides with the ball it'll send it flying, it works okay but is quite unpredictable with some odd effects. The main problem is how high the ball in thrown in the Y axis, no matter how much upForce I add or remove, it still has the same effect as in the photo. The amount of power has an effect but again seems to send it really high instead of far on a horizontal axis. Is there a more appropriate method or am I right in thinking power should control a horizontal axis. Quite puzzled
{
Vector3 explosionPos = transform.position;
Collider[] colliders = Physics.OverlapSphere(explosionPos, radius);
foreach (Collider hit in colliders)
{
Rigidbody rb = hit.GetComponent<Rigidbody>();
Debug.DrawRay(transform.position, hit.transform.position - transform.position, Color.red, 10.0F);
if (rb != null)
rb.AddExplosionForce(power, explosionPos, radius, upForce);
}
toomuchupforce.jpg
(87.1 kB)
Comment