I'm writing a game engine, but I've hit a mjor roadblock. You see I'm using GLtools and this allows you to easily move a camera around the 3D world, it also has a function that I believe returns the XYZ coordinates of the camera.
Only problem is that my character is supposed to have a gun, now in relation to the camera (and the direction the camera is facing) the gun is always in the same place.
The class GLFrame in gltools has some info on which way it's facing, I'm figuring I'll write a function that returns the vector.
So my chosen method of displaying the gun is essentially to convert (somehow) the new position of the camera AND the vector (the way the camera is facing) BACK to the default (namely 0,0,0 and 0,0, -1) and then REVERSE this on the constant position of the gun to receive the NEW gun location.
My question is, how do I this.
In other words how do I find the equation that will convert the coordinates.