View Full Version : FPS: Camera rotation and weapons

11-05-2010, 06:18 PM
Dear forum,

I have a question concerning the rotation of the camera in a FPS. When I want to rotate my camera, I use quaternions to change the value of my forward vector, so the player looks at a different direction. But I do not know how to change a weapon (or any other set of faces) along with the camera. Does anyone know how that can be achieved? The forward-vector is rotated like this:

right = forward.cross_product(up);
Quaternion qx(M_PI * rot_speed * dx, up);
Quaternion qy(M_PI * rot_speed * dy, right);

Could it be that an implementation with Euler-angles works better or is more simple? The main advantage for me for the above implementation is the fact that the forward-vector can be used in recursive raycasting etc (to see ehat a player has shot when clicking for example).


11-06-2010, 01:19 AM
yea it's more simpler than that, render the weapon last and don't include the camera movements