So I'm making a little basketball simulation game and I need a good way to calculate the path of a ball. I want to do this on a frame by frame basis where one frame lasts about 50 milliseconds. Each frame will store values for the state of the ball and then after applying some math, those values will be changed for the next frame.(adsbygoogle = window.adsbygoogle || []).push({});

So right now I have the horizontal and vertical positions, velocity, mass, and angle. I can add more variables if needed, these are just the first ones to come to my mind.

I think I can calculate the horizontal and vertical positions with something like this:

horizontal : newX = oldX + (oldVelocity * cos(angle))

vertical : newY = oldY + (oldVelocity * sin(angle))

If that is not a good way to do it, then let me know, it's just what I thought of with my limited physics knowledge.

I have no clue though how gravity and drag would factor in. I think the angle of the ball and the velocity should change from frame to frame, I just don't know how.

So, assuming a constant gravity, what would be a good way to make these calculations?

Thanks!

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Trajectory of a Ball

**Physics Forums | Science Articles, Homework Help, Discussion**