• Advertisement

Archived

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

works with eye but not matrix

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

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

Share this post


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

Share this post


Link to post
Share on other sites
Oppss
the function name is suppose to be
D3DXMARTRIXROTATIONY

Share this post


Link to post
Share on other sites

  • Advertisement