Jump to content
  • Advertisement
Sign in to follow this  
tbecker82

Getting started with mouselook

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

Hey Im trying to implement mouselook in my program. I currently have a class that will handle sliding along the axes, as well as yaw, roll, and pitch from keyboard input. Are there any good tutorials out there that can get me started, or if someone already has some code they wouldnt mind letting me take a look at I would apprecite it. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Typically, in mouselook, you will keep track of two variables: heading, and pitch. There is no explicit roll (you're always standing).

When you receive mouse input, you just apply the difference between the new position and the old position (mouse delta) to heading (for the X axis) and pitch (for the Y axis), by applying some scaling (for sensitivity).

When you want to get the camera orientation (each frame), you first rotate around the X axis by your pitch variable, and then rotate around the Y axis by your heading variable, and then you're done.

Share this post


Link to post
Share on other sites
Thanks Hplus for the reply. Do you know of any way that you can lock the mouse into the middle of the screen so that when the mouse will move, the screen will stay centered?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!