Jump to content
  • Advertisement
Sign in to follow this  
johnnyk

Trajectory equation

This topic is 3070 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need a trajectory formula:

Given the initial launch angle, the relative position of the target in x AND y (not the same horizontal plane), and gravity, how do I determine the initial launch speed?

I've been playing around trying to manipulate equations from here but no luck: http://en.wikipedia.org/wiki/Trajectory_of_a_projectile

If you can help thanks much!
-John

Share this post


Link to post
Share on other sites
Advertisement
Try to work out an example by hand. Post what you are doing (your plan and your computations) so we can see where you are getting stuck or where you are making a key mistake.

Share this post


Link to post
Share on other sites
Quote:
Original post by johnnyk
I need a trajectory formula:

Given the initial launch angle, the relative position of the target in x AND y (not the same horizontal plane), and gravity, how do I determine the initial launch speed?

I've been playing around trying to manipulate equations from here but no luck: http://en.wikipedia.org/wiki/Trajectory_of_a_projectile

If you can help thanks much!
-John


These are the equations of the motion:

x = (vcos(theta))t (1)
y = (vsin(theta))t - 1/2gt² (2)

The trajectory is the set of points (x,y) that verify those equations. You're not searching for a trajectory formula, you're simply searching for the value of v knowing a point of the trajectory (x*,y*) and the angle theta. By the way, if you use these equations, you will need to change the sign of y and x (edit: in the denominator) of the solution given by luca-deltodesco. It would be better for you to show us where you're stuck: it will provide you the occasion to learn something and not simply grab the solution.

P.S:
in (2): -1/2g if the gravity has the opposite direction of the y-axis, +1/2g otherwise.

[Edited by - johnstanp on July 16, 2010 11:31:04 AM]

Share this post


Link to post
Share on other sites
Thanks guys, very helpful. I went ahead and dusted off my algebra and solved those equations myself, solving for t then substituting into the other equation, then solving for v. I got the same result as luca, except a -2 term instead of a 2 (probably an oversight on my part).

Thanks again! I'll try it out in my game.

Share this post


Link to post
Share on other sites
Quote:
Original post by johnnyk
I got the same result as luca, except a -2 term instead of a 2 (probably an oversight on my part)


Off the top of my head, that probably just means we just had an opposing sign in the original equation: aka one of us had s = ut + 1/2at^2 and the other had s = ut - 1/2at^2

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!