Euler
A
Euler is a representation of a
rotation as a
vector, using pitch, yaw, and roll. Euler rotations can be most easily visualized as a tank turret mounted on the Y-Z plane with its barrel pointed down the Z-axis.
Second life first applies a rotation to the X-axis, which turns the turret. It then applies the Y rotation, which adjusts the angle of the barrel up and down. It then applies rotation to the Z-axis, which spins the barrel, kind of like a carriage bolt but without the in-and-out motion.
Anyone doing rotational
math in
SL is encouraged to learn how to use
quaternions, but for those who are limited to basic trigonometry, the X and Y
coordinate of Euler rotation can be derived between two points by finding the x,y, and z components of the distance between them, deriving the total distance between them, and using the following formulas:
X rotation = arctangent of (Y distance/Z distance) * -1
Y rotation = arcsine of (X distance/total distance)
Note (on rotation sign): In order to find the distances between the two points, it is necessary to subtract one point's coordinates from the others. For instance, X distance = P1.X - P2.X. Since subtraction isn't communtitive (x-y is not equal to y-x), which point is designated as P1 is important. For the X rotation, both the y and z components are affected by this, so regardless of their order, their bias cancels out as long as both signs are preserved. However, for the sign of the Y rotation to be correct the points must be ordered so Z1 is greater than Z2.
See
rotations for more information.
Functions
llEuler2Rot
llRot2Euler
Rotation |
Vector