kamimail

05-10-2010, 07:12 AM

Hi, I am novice in the 3D Math. I have a problem about FPS camera when i try to implement it using the quaternion.hope someone can help me.

(I use a quaternion to record the orientation of camera in world space

when the application need to update the camera, i actually orient the camera in world space.

after update,i use the orientation to build the matrix that can transform the camera to desired orientaion and postion in world space, then i inverse this matrix to get the view matrix.)

// pitch axis(1.0, 0.0, 0.0) yaw axis(0.0, 1.0, 0.0);

there are two rotation orders to orient the FPS camera:

(1) yaw firstly,and pitch secondly

(2) pitch firstly, and yaw.

according to my understand to the math,if i orient camera in world space using the the order(1), there is no roll in the scene. because after first rotation around the unit y axis, i will rotate around the new local x axis which deriveing from the prevoius yaw.

if i use the order (2) to transform camera, it will lead to roll of it.

unfortunately, the actual effect is not the same as what i expect when i using the order(1), if i use the order(2), it works well. i dont known the reason , hope someone can give me a explanation about it

Thanks in advanced.

(I use a quaternion to record the orientation of camera in world space

when the application need to update the camera, i actually orient the camera in world space.

after update,i use the orientation to build the matrix that can transform the camera to desired orientaion and postion in world space, then i inverse this matrix to get the view matrix.)

// pitch axis(1.0, 0.0, 0.0) yaw axis(0.0, 1.0, 0.0);

there are two rotation orders to orient the FPS camera:

(1) yaw firstly,and pitch secondly

(2) pitch firstly, and yaw.

according to my understand to the math,if i orient camera in world space using the the order(1), there is no roll in the scene. because after first rotation around the unit y axis, i will rotate around the new local x axis which deriveing from the prevoius yaw.

if i use the order (2) to transform camera, it will lead to roll of it.

unfortunately, the actual effect is not the same as what i expect when i using the order(1), if i use the order(2), it works well. i dont known the reason , hope someone can give me a explanation about it

Thanks in advanced.