Jump to content
  • Advertisement

Archived

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

DevLiquidKnight

Determaining rotation based on mouse?

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

Advertisement
without using a specific API:

1) get the cursor location

2) get the distance from the cursors current position from the center of the screen.

3) take the change in the x position and make a matrix of rotation around the y-axis, take the change in the y position and make a matrix of rotation around the right vector of your view.

4) multiply the two together, then modify your view matrix.

5) set your cursor position back to center of screen

very vague here, but it should hopefully put you on your way

Share this post


Link to post
Share on other sites
Geocities says "This page is not available".

Anyways, getting the rotation amount with DirectInput (as an alternative to tri''s method) is very easy. DirectInput will give you the relative amount the mouse has moved, and then you just add that amount to a variable holding the current rotation. Maybe look at the DirectInput SDK tutorials sometime.

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!