//Make a rotation matrix based on the camera's yaw & pitch
D3DXMATRIX mCameraRot;
D3DXMatrixRotationYawPitchRoll(&mCameraRot,MATH_DEGTORAD(m_Yaw),MATH_DEGTORAD(m_Pitch),0);
//Transform vectors based on camera's rotation matrix
D3DXVec3TransformCoord(&m_WorldUp,&m_LocalUp,&mCameraRot);
D3DXVec3TransformCoord(&m_WorldLookAt,&m_LocalLookAt,&mCameraRot);
D3DXVec3Normalize(&m_WorldUp,&m_WorldUp);
D3DXVec3Normalize(&m_WorldLookAt,&m_WorldLookAt);
D3DXVec3Cross(&m_WorldRight,&m_WorldUp,&m_WorldLookAt);
updating the camera
Hi guys!
ok i met this annoying problem of bridging local and world space camera coordinate system with a yaw-pitch rotational matrix. I am using the standard code provided by DXSDK.
Everything works fine when the camera is looking in the positive z direction.
Now what I am trying to do is to load some variables from a script that also specifies the actual world lookat direction and other variables. How do I make use of the loaded values and modify the existing codebase such that it takes into account the unmodified local coordinate system and the loaded values?
thx!
Edwin
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement