Original Post
I can't quite figure out current how to Transform the lookAt and up vector by the rotation matrix so the view is rotated about the player origin.
Cheers
Cheers
up.x = 0.0f;
up.y = 1.0f;
up.z = 0.0f;
// Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
pitch = m_rotationX * 0.0174532925f;
yaw = m_rotationY * 0.0174532925f;
roll = m_rotationZ * 0.0174532925f;
D3DXVECTOR3 rotation = D3DXVECTOR3(m_rotationX, m_rotationY, m_rotationZ);
D3DXVECTOR3 camera[3] = { D3DXVECTOR3(m_fCameraX, m_fCameraY, m_fCameraZ),//Eye
D3DXVECTOR3(m_fLookatX, m_fLookatY, m_fLookatZ),//LookAt
up };//Up
// Create the rotation matrix from the yaw, pitch, and roll values.
D3DXMatrixRotationYawPitchRoll(&rotationMatrix, yaw, pitch, roll);
//Translate in the direction of player rotation
D3DXVec3TransformCoord(&camera[0], &camera[0], &rotationMatrix);
// Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
D3DXVec3TransformCoord(&camera[1], &camera[1], &rotationMatrix);
D3DXVec3TransformCoord(&camera[2], &camera[2], &rotationMatrix);
camera[1] = camera[0] + camera[1];
D3DXMatrixLookAtLH(∈_viewMatrix, &camera[0], &camera[1], &camera[2]);