Using D3DXMatrixLookAtLH instead of rotx/y/z

Started by
1 comment, last by NotTaxes 21 years, 8 months ago
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.
'Doing the impossible is kind of fun' - Walt Disney
Advertisement
Have you tried using D3DXMatrixAffineTransformation() or D3DXMatrixTransformation() instead of rotX, rotY, rotZ ?

DOH! Thanks 3dmodelman... it''s amazing how much you can do with just a little bit of useful information.

Muchly appreciated!
'Doing the impossible is kind of fun' - Walt Disney

This topic is closed to new replies.

Advertisement