Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Mouse movement control of view vector.

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Jul 2001
    Posts
    533

    Mouse movement control of view vector.

    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?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    628

    Re: Mouse movement control of view vector.

    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.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Jul 2001
    Posts
    533

    Re: Mouse movement control of view vector.

    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!):
    http://www.mdibb.net/lotf/core3d.zip

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •