Sign in to follow this  

Projetile Motion problem

Recommended Posts

Hi all, I am currently tryin to program a basketball game with a ball displaying the correct projectile motion. I searched all the threads AND my physics book, and they both display equations finding x and y positions,i.e. in 2D. But I am working in a 3D environment, meaning there is a Z position in account. How do I calculate the xyz positions? Thanks! I am using these equations to find X and Y: X = (v0cos(angle))t Y = (v0sin(angle))t - (1/2gt^2)

Share this post

Link to post
Share on other sites
Using the formula in your book, x is the horizontal direction and y is vertical, with gravity acting in the negative y direction.

For 3D, x and z are 2 horizontal directions. turns out to be really, really simple to convert your equations over to 3D. You need another angle. Lets look at a top-down view of your situation, in 3D:

Z| /
| /

Lets say that horizontally, the basketball moves approximately along that diagonal line, which makes angle B between the X and Z axes, horizontally. The angle B is measured in radian from X. As shown, its value is positive and its in the first quadrant.

To modify your equations, just include separate equations for X and Z, and leave the Y equation as is, with no change:

X = v0*cos(B)*cos(angle)*t
Z = v0*sin(B)*cos(angle)*t
Y = v0*sin(angle)*t - (1/2gt2)

All I've really done is convert your one horizontal direction X into a horizontal vector (X,Z).

Share this post

Link to post
Share on other sites
Hi, Thanks for the equations!
But I think I'm calculating angle B wrong. How I'm doing it is that I'm taking the difference between the ball's initial position and the position of the hoop(where I want it to go) to get the distance of ball's X and Z displacement. Then I just arctan(Zdisplacement/Xdisplacement) to get the angle B. I don't believe that is precise. Any help? Thanks!!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this