# Euler Angle Camera

This topic is 5064 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I have a camera for my engine (well its not much as of now, considering it doesnt rotate right, lol) and i keep track of the Up, Right, and Forward vectors for it, now, based on a set of euler angles, id like to be able to calculate any two of those (ill just cross for the 3rd) Now this isnt that hard, but what i want to do, is not use matrices to do this, because if i have a matrix for yaw, pitch, and roll thats what, 12 trig functions? plus a bunch of multiplies and adds to concatonate all the matrices, now, there has got to be a way to skip over the matrices and rotate the vectors around the origin like that (now that doesnt sound hard, but only the first rotation would truely be around the origin, the rest would have to be in "object space") i actually have a formula to do this, but alas, its a lamothe book, and the equation is wrong, so, i googled, and found one that DID work, but unfortunately, it seems that the multiplication was in a different order, or the matrices were transposed. so anyways, i was hoping someone would be able to grasp waht the heck my tired brain is trying to say and have the equation for a vector rotated around the origin (i just had a revelation, if i did roll, pitch then yaw, then i COULD have it be around the origin coudlnt i? and then i could just use sin and cos to find the components in each plane still wouldnt mind having the other way, especially if im going crazy with my revelation :-D thanks -Dan [Edited by - Ademan555 on January 9, 2005 4:24:16 PM]

##### Share on other sites
UPDATE: no, my revelation didnt work out... heh, somethign is still amiss, so id be very happy if someone knows what im talking about and is willing to share the information

-Dan

##### Share on other sites
2 ways.

1.
Code your own lookat function with (0,1,0) as the initial upvector, you would cross the right and forward vecs later to get the real up vector.
This is in Basic though but would get the job done:

http://rel.betterwebber.com/junk.php?id=24

Tute I wrote for this:

http://www.petesqbsite.com/sections/express/issue2/index.html#3d

2. GlULookat.

##### Share on other sites
THanks, yeah ive been using gluLookAt(), and i guess i kinda lied, it does SORTA work, but not to the extent id like (aka its whacked) if i rotate around the y axis far enough, it just rolls over its own z axis... i WAS generating the basis vectors like this:
		//NO ROLL ON Z		//PITCH		Forward.y = static_cast <float> (sin(Pitch));		Forward.z = static_cast <float> (cos(Pitch));		//YAW		Forward.x = static_cast <float> (-sin(Yaw));		Forward.z *= static_cast <float> (cos(Yaw));		//		//RIGHT		//				//ROLL		Right.x = static_cast <float> (cos(Roll));		Right.y = static_cast <float> (-sin(Roll));		//PITCH		Right.y *= static_cast <float> (cos(Pitch));		Right.z = static_cast <float> (sin(Pitch));		//YAW		Right.x *= static_cast <float> (cos(Yaw));		Right.z *= static_cast <float> (sin(Yaw));*/		Cross(Up, Forward, Right);		Up.Normalize();

but it had the described problem

thanks
-Dan

1. 1
Rutin
63
2. 2
3. 3
4. 4
5. 5

• 15
• 10
• 29
• 20
• 9
• ### Forum Statistics

• Total Topics
633413
• Total Posts
3011757
• ### Who's Online (See full list)

There are no registered users currently online

×