Skip to content

llAxes2Rot

rotation llAxes2Rot(vector Forward, vector Left, vector Up)

Returns the rotation represented by coordinate axes Forward, Left, and Up.

Parameters
Forward (vector)
Forward/Back part of rotation.
Left (vector)
Left/Right part of rotation.
Up (vector)
Up/Down part of rotation.

All three vectors must be mutually orthogonal unit vectors. Technically, only the first two vectors are needed to define the rotation, which can be computed by calling any of these alternatives:

llAxes2Rot(fwd, left, fwd % left);
llAxes2Rot(left % up, left, up);
llAxes2Rot(fwd, up % fwd, up);
default
{
state_entry()
{
vector i = < 1.0, 0.0, 0.0>;
vector j = < 0.0, 1.0, 0.0>;
vector k = < 0.0, 0.0, 1.0>;
rotation rot = llAxes2Rot( j, -i, k );
llSay(0, (string) (llRot2Euler(rot) * RAD_TO_DEG) );
}
}

This script displays:

Object: <-0.00000, 0.00000, 90.00000>

This shows that (j, -i, k) is obtained by rotating (i, j, k) 90 degrees around the z direction.