Jump to content
  • Advertisement
Sign in to follow this  
Joseph T

Help with mouse look/camera movement

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

I'm trying to setup a basic mouse look and camera movement system using glut. Right now I have a vector that is my look at direction; I've got a MathVector and a MathMatrix class to handle the mathematics between the vector and rotating it. Basically, my idea is to translate the look at vector to the origin, rotate it, and translate it back. I start off by getting the change in mouse position, which is the previous mouse position minus the current mouse position for both X and Y. I then use a rotational matrices (as in the wikipedia article) to rotate my look at vector. The Z axis is my "up", so when I'm moving laterally(look at is confined to the XY plane) I just multiply the look at vector by the matrix that rotates the vector around the Z axis. The problem is when I move the view up or down. When I'm looking down the Y axis I obviously need to rotate my view by the X axis, when I'm looking down the X axis I need to rotate my view by the Y axis, and when I'm in between I need to rotate by an arbitrary axis. Can someone give me a hand with this? I'm currently using my own matrices and all to calculate this by hand, is there an easier way?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!