Difference between revisions of "LlAxes2Rot"

From Second Life Wiki
Jump to navigation Jump to search
m
m (Showing floats as floats)
Line 18: Line 18:
     {
     {
         rotation rot = llAxes2Rot(
         rotation rot = llAxes2Rot(
             < 0, 1, 0>,
             <   0.0, 1.0, 0.0>,
             < -1, 0, 0>,
             < -1.0, 0.0, 0.0>,
             < 0, 0, 1>);
             <   0.0, 0.0, 1.0>);


         llSay(0, (string) (llRot2Euler(rot) * RAD_TO_DEG) );
         llSay(0, (string) (llRot2Euler(rot) * RAD_TO_DEG) );

Revision as of 07:47, 6 April 2008

Summary

Function: rotation llAxes2Rot( vector fwd, vector left, vector up );
0.0 Forced Delay
10.0 Energy

Returns a rotation that is defined by the 3 coordinate axes

• vector fwd
• vector left
• vector up

All three vectors must be mutually orthogonal unit vectors.

Examples

<lsl> default {

   state_entry()
   {
       rotation rot = llAxes2Rot(
           <   0.0,  1.0,  0.0>,
           < -1.0,  0.0,  0.0>,
           <   0.0,  0.0,  1.0>);
       llSay(0, (string) (llRot2Euler(rot) * RAD_TO_DEG) );
   }

}</lsl>

This script shows that the (fwd, left, up) system of axes is rotated into (left, -fwd, up) with a 90° rotation around z direction.

Notes

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

llAxes2Rot(fwd, left, fwd % left);

Deep Notes

Signature

function rotation llAxes2Rot( vector fwd, vector left, vector up );