I have an fps camera, and i am representing rotation with quaternions. every frame i grab how much the mouse moved that frame and then i simply do

Quat DeltaQ = Quat::CreateRotationXYZ(MouseYDelta, MouseXDelta, 0);
m_CurrentRotationQ = DeltaQ * m_CurrentRotationQ;

however, everything works until i rotate 90 degrees to the right. when i do that i cannot rotate up and down. also, moving the direction i am facing works, however, depending on where i am looking strafing left and right moves me in different directions, I've tried many things such as reversing order of multiplication, i'm really at a loss. Any help would be greatly appreciated.


1 Answer 1


Thanks DMGregory. The article you mentioned didn't answer my question directly, however, it did in fact get me to start thinking about transformation space differently, which ultimately led me to implement a solution, Cheers!

Ok, so i've solved my issue. what i've done is allow my Camera's Rotate() method to accept a Space parameter such as

Camera::Rotate(Quat,ESpace = Local|World);

I then control camera rotation like this

Camera::Rotate(Quat::CreateRotation(DeltaY, Vec3(0,1,0)), ESpace::World);
Camera::Rotate(Quat::CreateRotation(DeltaX, Vec3(1,0,0)), ESpace::Local);

This allowed me to independently set the space per rotation, this works as expected. Quaternions are pretty difficult to get used to lol. PS, the Camera::Rotate() Method Looks Like This

void CFlyingCamera::Rotate( const CQuaternion& Rotation, ETransformSpace Space )
    if( Space == ETransformSpace::Local )
        m_Rotation = m_Rotation * Rotation;
    if( Space == ETransformSpace::World )
        m_Rotation = Rotation * m_Rotation;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .