Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: 3D Bullet Trajectory

  1. #1
    Newbie Newbie
    Join Date
    Dec 2012

    3D Bullet Trajectory

    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.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts