Skip to content
lsl.devlsl.devLSL Dev

llAxisAngle2Rot

function
Function syntax
rotation llAxisAngle2Rot(
  1. vector axis,// Axis vector to rotate around.
  2. float angle// Angle to rotate, in radians.
);
Returns
rotation
Energy
10

axis need not be normalized, only the direction is important.

angle need to be between the value 0<angle<PI (higher values than PI lead to 2*PI-angle)

, because a rotation is not really a rotation (it is more of a rigid motion/mirroring)

,the final destination is the rotation.

(in other words: it doesn’t matter wether you rotate left by 90 degrees or right by 270 degrees it will return the same rotation)

Returns a rotation that is a generated angle about axis

How to use
rotation result = llAxisAngle2Rot(ZERO_VECTOR, 0.0);
Example 1
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.
}
}
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 LlAxisAngle2Rot, 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.