Table of Contents

Start Functions Events Constants Types Language Articles

Function: llAxisAngle2Rot

rotation llAxisAngle2Rot(vector axis, float angle)

Returns a rotation resulting from turning over the given axis by the given angle in radians, counter-clockwise when seen from the position the vector points to.

For example, if the vector is <0, 0, 1> and the angle is 60*DEG_TO_RAD, it will turn 60 degrees over the Z axis counter-clockwise as seen from above, because the vector points up.

Parameters

axis

A vector specifying the axis the rotation will turn around.

angle

A float with the rotation angle, expressed in radians.

Return value

Returns a rotation that turns over the given axis by the given angle.

Short examples

// The following example will set "rot" to a rotation that turns 60 degrees
// counter-clockwise as seen from above, over the vertical Z axis:
rotation rot = llAxisAngle2Rot(<0, 0, 1>, 60*DEG_TO_RAD);

Complete examples

llAxisAngle2Rot-example.lsl
default
{
    state_entry()
    {
        llAxisAngle2Rot(1, 2);
    }
}

See also

Opposite conversion

Other conversions between rotation formats