- Home /
Increase velocity without changing trajectory
I have a rigidbody that has been launched high into the air. I've calculated the exact angle needed to hit a specific target on a distant battlefield, and it works perfectly. Now, however, I have been told to increase its velocity as it nears the ground. Is there a way to increase speed on the rigidbody without messing up the trajectory? The calculation for the trajectory is quite complex, and would be very difficult to modify directly for a sliding velocity.
Thanks! The equation I'm using is below:
float sqrt = (v * v * v * v) - (g * (g * (x * x) + 2 * y * (v * v)));
float theta1 = Mathf.Atan(((v * v) + Mathf.Sqrt(sqrt)) / (g * x));
Is the increased speed just for aesthetic reasons, or is is supposed to model some real physics (I can't think of any ballistic missile that has a rocket stage at the end!). I've answered assu$$anonymous$$g it's aesthetics.
Aesthetics. It just takes too long to get to its target the way it is now.
Answer by Waz · Sep 06, 2011 at 05:19 PM
If you increase gravity, both g and the actual gravity in the game (or just as applied to the projectile), you will get a higher overall speed.
Not if you change both gravity and the calculation taking gravity into account (I.e. g in you equation).
Any idea how I would go about that? It might not be the best idea though, since there may be multiple projectiles aloft simultaneously.
You have g in your equation. Physics gravity is set in Project Settings - Physics.
Believe me, it will work.