#### Archived

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.

## 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 on other sites

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

where:
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.

-me

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

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633410
• Total Posts
3011726
• ### Who's Online (See full list)

There are no registered users currently online

×