Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RiBa

Camera roll with D3DXQuaternionRotationYawPitchRoll

This topic is 5276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
"Young young young how stupid are the young..."

Move your vectors to world center, Yaw Pich and roll and move back.

.Pangplast

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!