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


works with eye but not matrix

Recommended Posts

kayX    152
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??

Share this post

Link to post
Share on other sites
-IceDragon-    122
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?

Share this post

Link to post
Share on other sites