Skip to main content
gamedev.net
🔒 Locked

Basic Quaternion camera math

Started by Dark_Streak 3 replies 1.1k views
Original Post
Dark_Streak
Dark_Streak
Hello, Could anyone please give me some pointers/clues on how to go about doing the following? My question concerns quaternions, something I am new to and am currently struggling with. I am using quaternions for my in-game camera, whereas I am more familiar with Eular angles. Anyway, once I have found the current quaternion of my camera, I would like to set the camera''s up vector to {0,1,0} i.e. straight up. So, how do I set a specific ‘vector’ within a quaternion?
JohnBolton
JohnBolton
quote:
Original post by Dark_Streak
...I would like to set the camera''s up vector to {0,1,0}...


Do you mean you want to rotate the camera so that its up vector is (0,1,0)?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Plotless
Plotless
Hi it''s me, I lost my email account (and therefore password) so I had to start a new account

Yes, JohnBolton, thats what I mean.

Basically, my quaternion camera is following an object around (third person viewing). I do this by setting the camera with the objects orientation (in quaternion form too) and then applying a translation offset to set the camera back behind the object. The objects orientation undergoes various rotations, such as rolling and pitching. Now, I dont want the camera to inherit these rotations, as it skews up my camera''s up vector! I still want to give the camera the same orientation as the object, but just revert my upvector to be straight up. I dont know how to do this with quaternions

Sorry, it''s difficult for me not to think of the camera in terms of vectors - Im really struggling with this quaternion stuff. Any tips are appreciated.

Topic Locked

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

Sign in to reply to this topic.