LlAxisAngle2Rot
Appearance
Function: rotation llAxisAngle2Rot( vector axis, float angle );
Returns a rotation that is a generated angle about axis
• vector axis
• float angle – expressed in radians.
axis need not be normalized, only the direction is important.
Examples
| <source lang="lsl">
default { state_entry()
{
vector axis = <0.0, 0.0, 1.0>;
float angle = 90.0 * DEG_TO_RAD;
rotation rot = llAxisAngle2Rot(axis, angle);
vector euler = llRot2Euler(rot) * RAD_TO_DEG;
llOwnerSay((string) euler);
//Says <0.0, 0.0, 90.0> since it is rotating 90 degrees on the Z axis caused by the 1.0 placed in the Z vector spot.
}
} </source> |
See Also
Functions
• llRot2Angle
• llRot2Axis
Deep Notes
| <source lang="lsl">
rotation llAxisAngle2Rot( vector axis, float angle ) { axis = llVecNorm( axis ) * llSin( angle/2 ); return <axis.x, axis.y, axis.z, llCos( angle/2 )>; } </source> |