Skip to main content
gamedev.net
🔒 Locked

Simplifying camera rotations

Started by Axiverse Apr 17, 2004 at 1:07 PM 3 replies 450+ views
Original Post
Axiverse
Axiverse
I''m trying to make a camera based on the following values First Distance from the target then Angle of attack or degrees off the y axis (rotate alone the X) then rotation around the Z axis then Roll on the current axis And lastly translate to the target. My question is can you simplify those rotations into one angle axis rotation instead of 3 for every time the camera moves??
Samith
Samith
You might want to look into quaternions, although those might just complicate things a bit.
JohnBolton
JohnBolton
Since each of those can be separately represented by a 4x4 matrix, you can create a matrix for each and multiply them all together to get a single matrix. Any time the location and/or orientation of the camera changes, recompute the combined matrix.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
SoulSpectre
SoulSpectre
You will problably be able to collapse down 2 or so of the matrices if you have a good look. The more transformations there are and the more variables, the harder it will be to collapse as the variables will spread through out the matrix.

The effect on performance for this will be negligable since it is your camera and you only have one normally in your scene then this code will only be called once per frame.
davedx
davedx
Quaternions are good. Google ''f00quat'' I think it''s called.

Topic Locked

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

Sign in to reply to this topic.