# updating the camera

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

## Recommended Posts

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?
//Make a rotation matrix based on the camera's yaw & pitch
D3DXMATRIX mCameraRot;

//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);


thx! Edwin

• 19
• 10
• 19
• 14
• 20