here is the directx 11 code

void UpdateCamera() { //d3d11 code camTarget = charPosition; camTarget = XMVectorSetY(camTarget, XMVectorGetY(camTarget)+5.0f); camRotationMatrix = XMMatrixRotationRollPitchYaw(camPitch, camYaw, 0); camPosition = XMVector3TransformNormal(DefaultForward, camRotationMatrix ); camPosition = XMVector3Normalize(camPosition); camPosition = (camPosition * charCamDist) + camTarget; camForward = XMVector3Normalize(camTarget - camPosition); // Get forward vector based on target camForward = XMVectorSetY(camForward, 0.0f); // set forwards y component to 0 so it lays only on camForward = XMVector3Normalize(camForward); camRight = XMVectorSet(-XMVectorGetZ(camForward), 0.0f, XMVectorGetX(camForward), 0.0f); camUp =XMVector3Normalize(XMVector3Cross(XMVector3Normalize(camPosition - camTarget), camRight)); camView = XMMatrixLookAtLH( camPosition, camTarget, camUp ); }

here is my attempt with d3d9

void UpdateCamera() { camTarget = charPosition; camTarget.y = ((camTarget.y)+5.0f); camRotationMatrix = D3DXMatrixRotationYawPitchRoll(&amp;amp;amp;amp;amp;yawPitchRollMat,-camPitch, camYaw, 0); //d3d9 camPosition = D3DXVec3TransformNormal(&amp;amp;amp;amp;amp;DefaultForward,&amp;amp;amp;amp;amp;DefaultForward, camRotationMatrix ); //so far i am stuck on this line, because camPosition should be D3DXVECTOR3* but if i set it to that, then the code below is broken , please can anyone help with coverting this to work with d3d9. camPosition = D3DXVec3Normalize(&amp;amp;amp;amp;amp;camPosition,&amp;amp;amp;amp;amp;camPosition); camPosition = ((*camPosition * charCamDist)) + camTarget; camvec3 = camTarget - camPosition; camForward = D3DXVec3Normalize(&amp;amp;amp;amp;amp;camvec3,&amp;amp;amp;amp;amp;camvec3); // Get forward vector based on target camForward = XMVectorSetY(camForward, 0.0f); // set forwards y component to 0 so it lays only on camForward = XMVector3Normalize(camForward); camRight = XMVectorSet(-XMVectorGetZ(camForward), 0.0f, XMVectorGetX(camForward), 0.0f); camUp =XMVector3Normalize(XMVector3Cross(XMVector3Normalize(camPosition - camTarget), camRight)); camView = D3DXMatrixLookAtLH( camPosition, camTarget, camUp ); */ }

here is a picture of the d3d11 app

http://imageshack.us/f/5/thirdpersoncam.jpg

**Edited by Anddos, 17 November 2012 - 08:43 AM.**