Archived

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

stapletonmt

Space Sim - View Matrix - Major Issues

Recommended Posts

Hi, I''m writing a space sim in DirectX 8.1 and I''m having a major issues writing the code to get the view to pitch, roll, and yaw correctly. I can build the view matrix for a quake style first-person view, but not a flight style view. Some help on this would be fantastic. Cheers

Share this post


Link to post
Share on other sites
Use a quaternion:

  
D3DXMATRIX matCameraOrientation;
D3DXQuaternionRotationYawPitchRoll(&qR, m_Camera.fYaw, m_Camera.fPitch, m_Camera.fRoll);
D3DXMatrixAffineTransformation(&matCameraOrientation, 1.0f, NULL, &qR, &m_Vehicle.vPos);


Dont ask me how it works, I only understand that D3DXMatrixAffineTransformation builds a transformation of scale, translation, and rotation using a quaternion which you build from yaw, pitch, and roll.


Come join us on IRC in #directxdev @ irc.afternet.org

Share this post


Link to post
Share on other sites
I agree with using Quaternions. only don''t use yaw, pitch and roll to save the rotation. use the quaternion itself to store the rotation of the ship or camera and multiply it by a quaternion containing the change in angle every frame

Share this post


Link to post
Share on other sites
quote:
Original post by Cybertron
I agree with using Quaternions. only don''t use yaw, pitch and roll to save the rotation. use the quaternion itself to store the rotation of the ship or camera and multiply it by a quaternion containing the change in angle every frame


I suggest you heed this advise. It will save you alot of time in the long run. You will eventually use this method anyway.

D.V.

Carpe Diem

Share this post


Link to post
Share on other sites
quote:
Original post by Cybertron
I agree with using Quaternions. only don''t use yaw, pitch and roll to save the rotation. use the quaternion itself to store the rotation of the ship or camera and multiply it by a quaternion containing the change in angle every frame


Can you explain that for me better? I cannot understand quaternions and in all honesty I likely never will. I cannot read descriptions of them because I like some fundamental math knowledge that is presumed by all those symbols they use to describe them (it''s quite literally Latin to me). Also, every time I try to get a basic understanding of the math they too introduce semantics that I dont know, appearently I missed something in high school that is presumed knowledge for all math above basic algebra and I cannot find that knowledge in any library books.

Anyhow, Why exactly is that better? Are you talking about the expense of creating that quaternion? Is that *really* a big deal 1 time per frame compared with the hundreds of thousands of other calcs your gonna make each frame?

And what is a "quaternion containing the change in angle every frame"?

I use yaw, pitch, roll values because it''s brutally simple (i.e. I understand how) to modify them each frame from user input. This is how the Donuts sample does it too.


__________________________________________________________
Sig: Come join us on IRC in #directxdev @ irc.afternet.org

Share this post


Link to post
Share on other sites