3D Vectors?
Im using OpenGL to move through a 3D world you can look around ect using a camera. I was wondering I am needing to find a way to add bullet fireing into the program. I was wondering how exactly I would go about finding the correct 3D vectors using the what I have. I have the postion of the user and the angle the user is located at with the camera. Now im simply trying to find how exactly to calculate the correct vector from the user to the direction the user is facing basically. How would you go about doing this?
Don''t click me!
Killer Eagle Software
i find that the easiest way to do it is to have every single object in my openGL world have a view, up & strafe vector as member variables. when i add a bullet:
bullet.pos = shooter.pos;
bullet.view = shooter.view;
bullet.up = shooter.up;
bullet.strafe = shooter.strafe;
bullet.vel = whatever bullet type speed....
done...the bullet is derived from a base Game_Object type, so i just push it onto the object stack and the engine takes care of moving it around..
-me
bullet.pos = shooter.pos;
bullet.view = shooter.view;
bullet.up = shooter.up;
bullet.strafe = shooter.strafe;
bullet.vel = whatever bullet type speed....
done...the bullet is derived from a base Game_Object type, so i just push it onto the object stack and the engine takes care of moving it around..
-me
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement