What is the parabolic formula for a 2D projectile's trajectory
I have a little jumping game where the heigh of the jump varies, so to make the game easier, I want to display the trajectory of the jump. To display it I decided to make a while loop that updates a Line Renderer's vertices, given a resolution int of how many vertices I want.
The only problem now is that I don't know how to get the projectile's trajectory as a function/equation. I will have a constant x velocity, and at the beginning of a jump I add a certain upwards-force. I've only been able to find one potentially useful equation, but it requires a force magnitude and an angle.
Answer by elenzil · Sep 07, 2016 at 06:34 PM
at the beginning of the jump, figure out the vertical velocity.
then this is the y_position as a function of x_position:
// gravity_constant is typically 9.8
t = x_position / x_velocity.
y_position = y_original + t * y_velocity - (t * t * gravity_constant / 2.0).