Hi, I am having problems modifying this code to get the underhand throw to be less curvey. I want it to arch less and be thrown more like a straight line with a slight downward curve. The current code works great for the overhand throw but not realistic for the underhand throw. I made a video showing the problem. I am using the code from: https://answers.unity.com/questions/886580/throw-grenade-with-definite-speed-and-on-definite.html Code (CSharp): public void Launch(ThrowType type, Vector3 dir, float dist) { float hSpeed = 10f; float gravity = Physics.gravity.magnitude; float totalTime = dist / hSpeed; float vSpeed = (totalTime * gravity) / 2; Vector3 force = new Vector3(dir.x * hSpeed, vSpeed, dir.z * hSpeed); rigid.velocity = force; Debug.DrawRay(transform.position, dir, Color.red, 3f); Debug.DrawRay(transform.position, force, Color.green, 3f); } I tried to modify the gravity/vertical speed/horizontal values manually but I did not work and was way off from the target. Maybe I need to use a different formula? I just want to get rid of the arch in the trajectory to make it match the animation more. Any help appreciated, thanks.
Just increase hSpeed. Simple physics. Faster you throw it the less high it needs to go to reach destination.
When I do that; the grenade does fly straighter but it also flies super far away from the target. I added some debug lines to show the direction vector and force vector.
Well, what you want isn't really how physics works in real life, so I don't know what you want to hear, you're going to have to give up something.