Jump to content
  • Advertisement

Archived

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

ilimo

mouse in directx : direction of movement

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

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!