Using D3DXMatrixLookAtLH instead of rotx/y/z
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.
Have you tried using D3DXMatrixAffineTransformation() or D3DXMatrixTransformation() instead of rotX, rotY, rotZ ?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement