works with eye but not matrix

Started by
2 comments, last by kayX 22 years, 6 months ago
This is a piece of code which i use to determine my camera position and orientation d3dvector Pos const MoveSpeed = 0.1 const RotationSpeed = 0.1 float rotY ''rotation angle along y axis if(key == up) { pos.x += sin(rotY)*MoveSpeed pos.z += cos(roty)*MoveSpeed } if(key == down) { pos.x -= sin(rotY)*MoveSpeed pos.z -= cos(rotY)*MoveSpeed } if(key == left) { rotY -= RotationSpeed } if(key == right) { rotY += RotationSpeed } //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' When i uses the eye point and eye to, it works fine ''im using vb D3DXMATRIXLOOKATLH matView,pos,vec3(pos.x+Sin(rotY),0,pos.z+cos(rotY)),vec3(0,1,0) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' but when i use the matrix way, i cant get it moving the right way D3DXMATRIXTRANSLATION matPos,pos.x,pos.y,pos.z D3DXMATRIXROTATION matRot,rotY D3DXMATRIXIDENTITY matView matView = matRot*matPos setTransform matView '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' where is my error??
Advertisement
mhh, I don''t know if I can help you, but your first part seems ok to me. ok, if it wasn''t correct, it wouldn''t work with the LOOKAT matrix anyway.

You can try using

matView = matPos*matRot

instead of

matView = matRot*matPos

but I won''t promise it works... The other part where the error could happen is the way you set your translation/rotation matrix. Which functions do you use here?
I just recognized that you''re using vb...


D3DXMATRIXROTATION matRot,rotY
What does this mean?

How can vb know that rotY is the Rotation around the Y axis?
Oppss
the function name is suppose to be
D3DXMARTRIXROTATIONY

This topic is closed to new replies.

Advertisement