3d trajectory - calculate initial velocity

Posted by Skoder on Game Development See other posts from Game Development or by Skoder
Published on 2011-03-06T18:48:45Z Indexed on 2011/03/07 0:18 UTC
Read the original article Hit count: 259

Filed under:
|
|
|

Hey, I've got a 2D projectile code sample working, but would like to extend it to 3D. How would I calculate the initial velocity of the Z-axis? At the moment, I've got:

initVel.X = (float)Math.Cos(45.0);
initVel.Y = (float)Math.Sin(45.0);

How would I convert this to work in 3D (and add the initial velocity for the Z-axis)?

In my example, X is across, Y is up down and Z is going into the screen. I also normalize the vector and multiply it by the speed. Thanks

© Game Development or respective owner

Related posts about 3d

Related posts about physics