This topic is now archived and is closed to further replies.

Using D3DXMatrixLookAtLH instead of rotx/y/z

This topic is 5589 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

I am trying to use the D3DXMatrixLookAtLH to rotate a mesh instead of the D3DXMatrixRotationX,D3DXMatrixRotationY,D3DXMatrixRotationZ functions. This seems like a plausible thing to do. What I do goes like this: D3DXMatrixScaling matMesh,SX,SY,SZ //Vup = CreateVector(0,1,0) D3DXMatrixLookAtLH matLookAt, MeshPoint, MeshTarget, Vup D3DXMatrixMultiply matMesh,MatLookAt,MatMesh d3dDevice.GetTransform(D3DTS_WORLD,CurrentWorldMatrix) D3DXMatrixMultiply (NewWorldMatrix,matMesh,CurrentWorldMatrix) d3dDevice.SetTransform(D3DTS_WORLD,NewWorldMatrix) // Render the mesh My other code for rendering meshes by angles x,y,z includes a matrix translation line. I don''t do one here because... well, with the camera the MatrixLookAtLH seems to both rotate and translate the camera. Any help on getting this to work would be superb. If it can be done at all.

Share this post

Link to post
Share on other sites