
Camera/Quaternion "side-effect" or "bug"?
Hey all,
I am just getting into learning Quaternion''s for camera rotation and such, so I am not so sure about whether or not this is a bug or simply a side-effect with using Quaternion''s for rotation.
In "Game Tutorials", tutorial number 7 (free 3D movement) I have noticed that, if I continuously move the camera in a clockwise direction (up, right, down, left, ...repeat) keeping an asteroid in sight, the asteroid I am watching will spin in a counter-clockwise direction (so that after doing this a couple times, then squaring the camera back on the asteroid, you can easily see that the asteroid has rotated, so that what was the asteroids "top" before is no longer so).
Is this what should happen? Or does this only happen because Z axis rotation is permitted? This also occurs with the "Descent-style Camera Demo" found here...where Quaternion''s are also used...
Sorry if it sounds a bit vague, I am still trying to get a handle on these Quaternion''s myself

The guy who invented the first wheel was an idiot. The guy who invented the other three, he was the genius.
the reason is because at some point, the asteriod will be out directly to your left or right.. so if you rotate up or down, the asteriod will still stay to your left or right, but, if you were looking towards it, while you rotate up or down, your view will be rotating around the centre of the asteroid.. hence when you get back to looking at it, your looking at it at a different orientation. You should notice the background, and everything else, does this too.
| - Project-X - my mega project.. getting warmer
- | - adDeath - an ad blocker I made - | - email me - |
| - Project-X - my mega project.. getting warmer

What would be required to "fix" this so that this end rotation doesn't appear? Or is it even feasible with Quaternions? From what I have found so far, most demo code I see does not have a direct "fix" for this. I tried converting the quaternion to euler angles then modifying these, and it works to a point, but I get occasional eratic jumping.
I've noticed that some demos have two separate camera modes, one that uses standard euler rotation's, for moving around (up until the point of gimbal lock), and another that uses quaternions for interpolation and such between different view points (and takes over at the point of gimbal lock or possible gimbal lock occuring).
Is this the best way to handle this or am I just off my rocker?
I think I might just try implementing the above method and see what happens...
EDIT: Woot! just got it! Implemented a dual camera system that uses quaternions for the rotations and interpolations, and quaternions with euler angles for a restricted camera system where any axis can be restricted through code to prevent gimble lock. Guess this is one way to learn quaternions
Thanks for the help.
[edited by - mr_dejao on April 15, 2003 9:25:11 PM]
I've noticed that some demos have two separate camera modes, one that uses standard euler rotation's, for moving around (up until the point of gimbal lock), and another that uses quaternions for interpolation and such between different view points (and takes over at the point of gimbal lock or possible gimbal lock occuring).
Is this the best way to handle this or am I just off my rocker?

EDIT: Woot! just got it! Implemented a dual camera system that uses quaternions for the rotations and interpolations, and quaternions with euler angles for a restricted camera system where any axis can be restricted through code to prevent gimble lock. Guess this is one way to learn quaternions

Thanks for the help.
[edited by - mr_dejao on April 15, 2003 9:25:11 PM]
The guy who invented the first wheel was an idiot. The guy who invented the other three, he was the genius.
there is no ''fix'', because it isn''t a bug... it''s just an effect that independant rotation has. If you don''t want to rotate this way, then you will need to use a rotation system where you are locked to an axis, ala quake, etc.
for arguments sake also, you don''t actually need quats to do what lesson 7 actually does... a standard matrix rotation works just fine.
| - Project-X - my mega project.. getting warmer
- | - adDeath - an ad blocker I made - | - email me - |
for arguments sake also, you don''t actually need quats to do what lesson 7 actually does... a standard matrix rotation works just fine.
| - Project-X - my mega project.. getting warmer

Hadn''t refreshed my browser in quite a while - didn''t notice that you responded.
I worked it out - Quaternion''s are fun
Thanks again RipTorn.
I worked it out - Quaternion''s are fun

Thanks again RipTorn.
The guy who invented the first wheel was an idiot. The guy who invented the other three, he was the genius.
Noob alert!
What makes quaternion rotation better than ordinary matrix rotations?
/Para
What makes quaternion rotation better than ordinary matrix rotations?
/Para
April 16, 2003 01:02 PM
quote:
Original post by parazyte
Noob alert!
What makes quaternion rotation better than ordinary matrix rotations?
It''s somewhat simpler to code interpolation between two quaternions.
Also, quaternoins take up a little space in RAM.
That''s about it.
And "quaternion" sounds cooler than "matrix". Wait, does it?
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
Dunno, but I sure won't be going to see 'The Quaternion II' when it comes out.

[edited by - JuNC on April 16, 2003 6:57:30 PM]

[edited by - JuNC on April 16, 2003 6:57:30 PM]
quote:
Original post by JuNC
Dunno, but I sure won''t be going to see ''The Quaternion II'' when it comes out.
[edited by - JuNC on April 16, 2003 6:57:30 PM]
Matrix sounds cooler - I mean, really, how often have you heard "Quaternion" mentioned on Star Trek versus "Matrix".
Besides - the victor is obvious...
The guy who invented the first wheel was an idiot. The guy who invented the other three, he was the genius.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement