Skip to content
lsl.devlsl.devLSL Dev

llAxes2Rot

function
Function syntax
rotation llAxes2Rot(
  1. vector fwd,// Forward/back directional vector of the rotation.
  2. vector left,// Left/right directional vector of the rotation.
  3. vector up// Up/down directional vector of the rotation.
);
Returns
rotation
Energy
10

All three vectors must be mutually orthogonal unit vectors.

Returns a rotation that is defined by the 3 coordinate axes

How to use
rotation result = llAxes2Rot(ZERO_VECTOR, ZERO_VECTOR, ZERO_VECTOR);
Example 1
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>

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

Technically, only the first two vectors are needed to define this rotation, which can be done by calling any of these:

llAxes2Rot(fwd, left, fwd % left);
llAxes2Rot(left % up, left, up);
llAxes2Rot(fwd, up % fwd, up);
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from LlAxes2Rot, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.