Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Mouse Look and Motion Sickness

This topic is 4976 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 pretty new to 3D programming. I'm using OpenGL to create a mouselook program. First off, how do I do mouselook? Like what Maya (the 3D modeling software) uses. This is what I have so far (psuedo code of course)
  OldMouseX = MouseX
  OldMouseY = MouseY
  MouseX = X
  MouseY = Y
  If LeftButton
      xrot = xrot + (OldMouseX - MouseX)
      yrot = yrot + (OldMouseY - MouseY)
  If RightButton
      zoom = zoom + (OldMouseY - MouseY) / 20
  If MiddleButton
      xtranslate = xtranslate + (OldMouseX - MouseX) / 100
      ytranslate = ytranslate + (OldMouseY - MouseY) / 100
  glTranslatef (0, 0, -zoom)

  glRotatef (xrot, 1, 0, 0)
  glRotatef (yrot, 0, 1, 0)
  glTranslatef (0, ytranslate, 0)
  glTranslatef (xtranslate, 0, 0)
This doesn't take into consideration z axis movements, so the controls become seriously weird after a little bit. Obviously I need to interpret the mouse commands depending on the current perspective, so that to the mouse the Z axis is always sticking straight out of the screen. How do I do that? Second: This is really my start into 3D programming. Some 3D games get me incredibly motion sick. These tend to be indie games. Professional games, such as Unreal Tournament, etc. don't get me sick at all, and I can usually play them for a long time. I think the answer has something to do with sudden jerkiness of the controls. In UT, if you press up you accelerate forwards instead of instantly start moving at a predefined speed. I'm wondering if there are any articles or people's thoughts on this? This is more a design philosophy than anything else though...

Share this post

Link to post
Share on other sites
Well to handle your second question you have 2 options - depending on what the game will include. The simplest (and this works in pretty much all situations) is to have a speed variable. If your game uses a form of delta tweening you will have this anyway (although it will most likely be constant). All you need to do is when ever the player moves forward increment the 'speed.' Also, make sure you cap it ^_^

About, your first question - I don't know, but I'm going to keep reading this thread because I need to know how ;)


Share this post

Link to post
Share on other sites
I think what I need to do here is the opposite of what happens when objects are projected onto the screen. I need to project the screen coordinates (the mouse) onto the world.

You'd have the same problem if you try to figure out where the user clicked on a 3D scene, so I'm sure this is a relatively common problem.

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!