• Advertisement
Sign in to follow this  

updating the camera

This topic is 4147 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 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;
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);

thx! Edwin

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement