Unofficial LSL Reference

[[functions:llaxisangle2rot]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

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

See also

Opposite conversion

Other conversions between rotation formats

  • llRot2Fwd extracts the X axis of a rotation.
  • llRot2Left extracts the Y axis of a rotation.
  • llRot2Up extracts the Z axis of a rotation.
  • llAxes2Rot converts the three axes of an orthonormal basis (the three vectors above) to a rotation.
  • llRot2Euler and llEuler2Rot work with Euler angles (the ones the viewer shows).