Skip to main content
gamedev.net
🔒 Locked

Funny view direction problem

Started by OrangyTang 1 reply 600+ views
Original Post
OrangyTang
OrangyTang
I''m trying to figure out a good way to do view orientation but I''m a bit stuck. Basically what I want is a general view direction (like NE, up, etc.) in which the camera will face. Along with this will be a cursor which the user controls on the screen. By pushing it towards the edges the view will rotate somewhat. Ideally this isn''t totally like a FPS camera since the mouse movement only slightly affects the view. (If anyones played Rez or Panzer Dragoon thats the kind of thing I''m after). Now my first thought would be to have two vectors, a general-direction one and a user-controled one which would offset the first for the mouse control. I''d have to convert the user-controled into the same space as the general one, then use it to offset and get the final view direction. But I have a funny feeling that using vectors like this is going to produce some funny effects as the vectors become denormalised with large offsets. Second though was some sort of eulear angles to control both, but I''m not sure if this''ll cause annoying problems like gimbal lock or be tricky to get the angles out of. I have a funny feeling that quaternions would be the best way, but I have no idea how they work so thats just a hunch. Anyone have any suggestions either way? Cheers.
orbano
orbano
to avoid gimbal lock, use quaternions.
you should store the "default" camera position (without the mouse offset thing), and store the "deafult"+offset, as the current camera. so you can restore the default camera every time you need, and save spare computations when camera is not moved.

"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
Indigo Darkwolf
Indigo Darkwolf
http://www.cs.berkeley.edu/~laura/cs184/quat/quaternion.html

Neat little page Berkeley's website on using Quaternions. Check it out.

Edit: Don't worry, it explains what Quaternions are, too.



"Remember: Silly is a state of Mind, Stupid is a way of Life." -- Dave Butler

[edited by - Indigo Darkwolf on January 27, 2004 4:41:28 PM]

Globals are not evil. Singletons are evil.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.