View Full Version : 3D Bullet Trajectory

12-10-2012, 02:07 PM
Sorry in advance, I'm sure there are many of these (although searching has not helped me so far :/ )

I have a game written, simple 3d asteroids kinda thing, except I can't figure out bullet trajectory.
How do I figure out where to update the position of my bullet to?

I'm looking along the z-axis in the negative direction. My mouse moves the camera angle and updates xrot
and yrot from 0,0 in the center of the screen. How do I convert my xrot/yrot and bullet_speed into a
3D co-ordinate on each update?

Any help would be appreciated, be it code, math or just pointers.

Thank you

I've come across "x += cos(direction) * pi/180 * bullet_speed" and it's y equivalent numerous times, but I can't
figure out what direction is. Plugging in xrot/yrot doesn't seem to help, and my high school trigonometry is a little
too dusty to work out where the pi/180 is coming from. I gather this is only useful for 2d stuff though.

12-11-2012, 11:55 PM
How far the bullet has traveled is the radius of a sphere, so you calculate a point on the sphere given 2 angles and a radius