Camera roll with D3DXQuaternionRotationYawPitchRoll
Hi all,
Right now i'm in the process of making a camera class,with the culling example of the dxsdk as guideline.
Problem is they're not using the roll function, like this:
D3DXQuaternionRotationYawPitchRoll( &qR, m_fAngleZ,m_fAngleY, 0.0f);
Now when i try add the roll angle myself (instead of the 0.0f) the camera rolls, like it should, but the yaw and pitch rotations don't seem to follow, it's like they are rotated around a fixed world-axis.
So is there anybody who can help me with this problem, it seems that i can't tackle this problem by my self.
Thanks.
[edited by - RiBa on June 6, 2004 5:32:08 PM]
"Young young young how stupid are the young..."
Move your vectors to world center, Yaw Pich and roll and move back.
.Pangplast
Move your vectors to world center, Yaw Pich and roll and move back.
.Pangplast
Well, i'm not that young ;-).
Anyway, does this mean i have to create a new quaternion every frame, apply the rotation angles to it and multiply it with the 'main' quaternion, from wich i create the view matrix?
[edited by - RiBa on June 7, 2004 2:18:00 AM]
Anyway, does this mean i have to create a new quaternion every frame, apply the rotation angles to it and multiply it with the 'main' quaternion, from wich i create the view matrix?
[edited by - RiBa on June 7, 2004 2:18:00 AM]
Hi,
I had the same problem as you, till I had found a tutorial about that.
You could find it here:
http://home.iprimus.com.au/narcain/tobymurray/gobsmacked/cameratutorial.html
I tried it and it works! You might be able to create every camera you want after having that code!
Happy Coding!
cu
I had the same problem as you, till I had found a tutorial about that.
You could find it here:
http://home.iprimus.com.au/narcain/tobymurray/gobsmacked/cameratutorial.html
I tried it and it works! You might be able to create every camera you want after having that code!
Happy Coding!
cu
quote:Original post by stefan5000
Hi,
I had the same problem as you, till I had found a tutorial about that.
You could find it here:
http://home.iprimus.com.au/narcain/tobymurray/gobsmacked/cameratutorial.html
I tried it and it works! You might be able to create every camera you want after having that code!
Happy Coding!
cu
Hmmm, i tried that one already, but i got the rotation error (gimbal lock i think?) when using this line:
D3DXMatrixRotationAxis(&matRotAboutUp,&m_vUp,m_fRotAboutUp);
(it''s in the updatedevice function).
When i change it to this:
D3DXMatrixRotationAxis(&matRotAboutUp,&D3DXVECTOR3(0.0f,1.0f,0.0),m_fRotAboutUp), it works, but it isn''t enough to do a yaw/pitch/roll camera.
Hi!
I have 2 world matrix in object space: Object matrix and Player matrix.
All matrixes containing position (._41 - ._43) and transform data.
I like to transform Object to turn toward Player, but i don''t know how i do it.
I used fTurn and fUp FLOAT values to transform like:
D3DXQuaternionRotationYawPitchRoll(&qR, fTurn,fUp,0);
D3DXMatrixRotationQuaternion(&matR,&qR);
D3DXMatrixTranslation(&matT,vVelocity.x,vVelocity.y,vVelocity.z);
D3DXMatrixMultiply(&matPosition, &matR, &matPosition);
D3DXMatrixMultiply(&matPosition, &matT, &matPosition);
Anybody know how i compute fTurn and fUp values?
Thx.
I have 2 world matrix in object space: Object matrix and Player matrix.
All matrixes containing position (._41 - ._43) and transform data.
I like to transform Object to turn toward Player, but i don''t know how i do it.
I used fTurn and fUp FLOAT values to transform like:
D3DXQuaternionRotationYawPitchRoll(&qR, fTurn,fUp,0);
D3DXMatrixRotationQuaternion(&matR,&qR);
D3DXMatrixTranslation(&matT,vVelocity.x,vVelocity.y,vVelocity.z);
D3DXMatrixMultiply(&matPosition, &matR, &matPosition);
D3DXMatrixMultiply(&matPosition, &matT, &matPosition);
Anybody know how i compute fTurn and fUp values?
Thx.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement