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.

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?

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633708
• Total Posts
3013468
×