Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Paths in a 3d game

This topic is 5961 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 am currently working on a small 3d tennis game using java and wildtangent, (although my experience lends towards c++ with a bit of Opengl and DX knowledge) My question relates to paths and tracjectories of object in a 3d space, Since its a tennis game I working on, I was hoping someone may have some information that could help me plot the path of a ball along a curved tracjectory, For example if the user hit the ball hard, the ball will go straight, with a small curve, were it will go high with a large curve for a lob shot,................ Is there anyone out there that could point me in the direction of some answers, in making these calculations. no doubt ppl have come accross this problem in other sport type games with a ball being passed around, (ie soccer and american football). I guess the same applies for missiles and artillery in a RPS style game, Thanks in Advacne for any help

Share this post

Link to post
Share on other sites
short snide answer: learn physics.

longer more helpdul answer: you want to learn mechanical physics and implement gravity. the curve will automagically happen when you implement a physics engine that operates on your ball

the basic equation is:

s(t) = s0 + v0 * t + 1/2 * a * t^2

s is position
s0 is the position it was most recently
v0 is the velocity it had last time
and a is the acceleration due to gravity (a on earth is approximately 9.8m/s^2 in the direction of down. i don't know what that is in feet/second^2)
and t is the amount of time that has passed since you last calculated the position

[EDIT: another key point i forgot to add is that you calculate that equation indepentandly for each of the x,y,z components of motion. acceleration due to gravity only effects the y component. you don't need to calculate acceleration in the other dimensions unless there is another external force causeing acceleration.]

the curvy path of a tennis ball with no spin is due to that equation. if you want to correctly model a tennis ball with spin, i'd suggest coming up with some tricks if you don't already know physics. the math for aerodynamics of a ball w/ spin isn't easy.


[edited by - Palidine on July 26, 2002 2:45:06 PM]

Share this post

Link to post
Share on other sites

  • 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!