Skip to main content
GameDev.net gamedev.net
🔒 Locked

Euler angles to 3d vector

Started by CoiN Sep 10, 2003 at 8:57 AM 1 replies 1.5k views
Original Post
CoiN
CoiN
Lo all, I am using a euler camera, and I am trying to figure out how I would change the three euler angles (x, y, z) that represent the direction of the camera, into a single unit vector. This is so I can move my camera in the direction it is pointing. Any ideas? Thanks, Coin
Aselus
Aselus
*breathes in* ok first i would like to state that using Euler angles is not a good way to do camera at all, it has alot of interfierences and tends to break alot...this is one of the problems with them.

to convert euler into a directional vector ((at)-z matrix vector) by getting the matrix out of it




RGT UP AT POS
[x x X x]
[y y Y y]
[z z Z z]
[0 0 0 1]
^
that''s the one you need

psi angle = Y
phi angle = p
theta angle = t

here''s the equatiion for the AT vector, you haveto run this to convert it from eulers to the AT vector:

AT = { x = sin(y) * sin(t), y = cos(y)*sin(t), z=cos(t)}

jsut in case you need them, here are the eyesores(i mean the other vectors):

Right =
{
x = (cos(y)*cos(p) - cos(t)*sin(p)*sin(y)),
y = (-sin(y)*cos(p) - cos(t)*sin(p)*sin(y)),
z = (sin(t)*sin(p))
}

UP =
{
x = (cos(y)*sin(p) + cos(t)*cos(p)*sin(y)),
y = (-sin(y)*sin(p) - cos(t)*cos(p)*cos(y)),
z = (-sin(t)*cos(p))
}


...after all consideration you could jsut use matricies, the APIs use them anyways and make code faster , but if you like the eulers, and really wanna use them the math is all there.

~Alexei Andreyevitch Kozlenok
~Alexei Andreyevitch Kozlenok~~ElectronicArts: RedWood Shores~
CoiN
CoiN
Thanks for the help.

Coin

Topic Locked

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

Sign in to reply to this topic.