View Full Version : Mouse movement control of view vector.
02-15-2004, 03:54 AM
How do I setup matrices to apply a transform in 3D space given mouse x and y movement? What I'm looking to achieve is a "freelancer" style of movement (if anyone has played freelancer!).
I have started with a rotation around the y axis (x mouse movement), and concatenated an x axis rotation ( y mouse movement ), but on my demo cube, the combination doesn't look right. Any ideas?
Originally posted by Robbo:
...the combination doesn't look right. Any ideas?No, unless you provide more detail about how are you doing it.
Anyway, if you're using matrices I suggest to leave them out of the way and go for the simpler Rotatef this could help.
In case it does not work anyway, try changing the order in wich you apply rotations. I don't have my code at hand right now but I remember I had to change something in the order to make it work.
After you fixed that using Rotatef maybe you'll want to use matrices again, if you really care.
02-18-2004, 08:18 AM
Well, I got it working just fine, by using up/right/lookat vectors and rotating them using Quaternions. I was lazy and didn't want to have to go down that route!
There is a demo here (hosted on a mates website until I get a sourceforge account sorted!):
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.