Jump to content
  • Advertisement
Sign in to follow this  
Ademan555

Euler Angle Camera

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!