Table of Contents

Start Functions Events Constants Types Language Articles

Function: llRot2Fwd

vector llRot2Fwd(rotation rot)

Returns the local X (forward) vector of a rotation.

Parameters

rot

The rotation whose X vector is to be returned.

Return value

Returns a unit vector that is the local X vector for that rotation.

Notes

Complete examples

This script, if used in an attachment, will rez an object 1.5 m in front of the avatar's center when touched. If used in an object that is not attached, it will rez the object 1.5m away in the direction of its local X axis.

llRot2Fwd-example.lsl
default
{
    touch_start(integer num)
    {
        vector pos = llGetPos() + llRot2Fwd(llGetRot())*1.5;
        llRezObject("Object", pos, <0,0,0>, llGetRot(), 1);
    }
}

See also