I'm working on sort of a space shooter, where you can rotate your ship arround both x, y and z axis and thus shoot in any direction. To rotate the ship (I'm using openGL in c++), im rotating with 0-360 degrees arround either the x, y or z axis. The camera will always look the same direction (down along the z axis, like "default"). You simply look at the ship rotating.
Example: glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); The above example will rotate the ship -90 degrees arround the x axis. If the ship was pointing up along the positive y axis like in an ordinary space shooter before the roation, the ship would point inn along the negative z axis after the rotation.
What I'm struggeling to figure out, is how to, at any time, be able to calculate the "direction" of the ship, and turn it into a vector3d (x, y, z inside a class called vector3d).
I calculate the position (another vector3d, simply x, y and z) of any moving object by adding current position (x y z) to a velocity that I also store in a vector3d, and multiply it by delta time (time since last frame/update). When I shoot a projectile from the spaceship, I want to have the direction vector of the ship to use it as basis for the velocity of the projectile I'm shooting, so that I can calculate the position of the projectile the same way I calculate position of other objects by simply adding current projectile position to the velocity multiplied by deltatime.
Since I have the direction of the ship on the form of rotation arround x, y and z, I figure it must be posible to somehow turn this into a vector3d that represents the same direction in a vector format (if that makes sence).