Jump to content
  • Advertisement
Sign in to follow this  
chillypacman

Good throwing (arc) equation?

This topic is 3553 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

OK this was one of those things which should not have taken as long as it has but hey what the hey. Basically I'm working on an equation which will control the y position of a thrown object as a parabolic function. My first attempt was to use sin however it has the (in this case)unfortunate habit of going in waves. at the point of origin the object must be at (0, 0) at x = distance thrown y should equal 0. Would anyone have any good ideas on an equation for this? I'm working on one right now but it doesn't look too pretty and was wondering if there is a standard equation that could work better.

Share this post


Link to post
Share on other sites
Advertisement
[Low caffeine warning, take these with a grain of salt]

In a vacuum with constant vertical gravity G, if the initial velocity is (vx,vy) then the position as a function of time is x = 0 + t * vx (there's no slowdown) horizontally and y = 0 + t * vy - 0.5 * G * t * t (downwards acceleration due to gravity).

Solving for y = 0 yields t = 0 and t = 2 * vy / G, and thus a horizontal position of x = vx * vy * 2 / G.

Share this post


Link to post
Share on other sites
Maybe I didn't do it right before, but I didn't like the way the projectile physics equation looked when implemented. It seemed to make triangles instead of arcs.

You could use projectile physics to determine the horizontal length to go, but for the vertical arc, I just used a 2D Bezier curve. http://en.wikipedia.org/wiki/Bezier_curves. A 3D one would probably look even better. But a 2D one does a pretty good job.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!