Archived

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

ilimo

mouse in directx : direction of movement

Recommended Posts

ilimo    122
hello, how get the direction of mouvement when moving the mouse ? using directx (9) ? perhaps using DIMOUSESTATE , but i don''t know how.. this is for a camera move ... thank you for your help ..

Share this post


Link to post
Share on other sites
circlesoft    1178
DIMOUSESTATE has lX, lY, and lZ members in it (lZ is commonly for the mouse wheel). With a mouse, these members describe the amount of change, not the actual position.

If lX is less than zero, the user is moving their mouse left, and if greater than zero, they are moving their mouse right (IIRC). If lY is less than zero, the user is moving the mouse down, but if it''s greater than zero, it''s being moved up

Share this post


Link to post
Share on other sites
Raloth    379
position.x = (view.x + distance*sinf(rotationY)*sinf(rotationX));
position.z = (view.z + distance*cosf(rotationY)*sinf(rotationX));
position.y = -(view.y + distance*cosf(rotationX));
This is part of my camera code... position is a vector for the position of the camera. view is a vector for the spot you are looking at with the camera. rotationX/rotationY are their respective changes in mouse movement. Copy and paste at your own risk.

[edited by - Raloth on January 17, 2004 1:01:16 AM]

Share this post


Link to post
Share on other sites