Unofficial LSL Reference

[[functions:llrot2fwd]]


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

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

functions:llrot2fwd [2014-12-09 16:47 SLT]
sei Add nav
functions:llrot2fwd [2015-02-04 13:27 SLT] (current)
sei style, and change example to 1.5m
Line 11: Line 11:
  
 === rot === === rot ===
-The [[types/rotation]] whose X vector is to be returned.+The $lty[rotation] whose X vector is to be returned.
  
 ===== Return value ===== ===== Return value =====
  
-Returns a unit [[types/vector]] that is the local X vector for that rotation.+Returns a unit $lty[vector] that is the local X vector for that rotation.
  
 ===== Notes ===== ===== Notes =====
  
-  * This function is roughly equivalent to ''<​1,​ 0, 0>​*rot'',​ except for the fact that the vector is normalized. When working with rotations that are guaranteed to be normalized (such as the ones that [[llGetRot]], [[llEuler2Rot]] etc. return), it's faster to use ''<​1,​ 0, 0>​*rot''​ than **llRot2Fwd**+  * This function is roughly equivalent to ''<​1,​ 0, 0>​*rot'',​ except for the fact that the vector is normalized. When working with rotations that are guaranteed to be normalized (such as the ones that $lfn[llGetRot], ​$lfn[llEuler2Rot] etc. return), it's faster to use ''<​1,​ 0, 0>​*rot''​ than $fn[llRot2Fwd]
-  * The forward (X) vector is special in many physics-related applications in SL. For example, ''​llRot2Fwd(llGetRot())''​ (or equivalently,​ ''<​1,​0,​0>​*llGetRot()''​) used in the root of an attachment gives the direction the avatar is facing; vehicles also use the X vector as the direction to move towards.+  * The forward (X) vector is special in many physics-related applications in SL. For example, ''​llRot2Fwd(llGetRot())''​ (or equivalently,​ ''<​1,​0,​0>​*llGetRot()''​) used in the root of an attachment gives the direction the avatar is facing; vehicles also use the X vector as the direction to move towards ​by default.
  
 ===== Complete examples ===== ===== Complete examples =====
  
-This script, if used in an attachment, will rez an object 1 m in front of the avatar'​s center when touched. If used in an object that is not attached, it will rez the object ​1m away in the direction of its local X axis.+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.
  
 <file lsl2 llRot2Fwd-example.lsl>​ <file lsl2 llRot2Fwd-example.lsl>​
Line 31: Line 31:
     touch_start(integer num)     touch_start(integer num)
     {     {
-        vector pos = llGetPos() + llRot2Fwd(llGetRot());​+        vector pos = llGetPos() + llRot2Fwd(llGetRot())*1.5;
         llRezObject("​Object",​ pos, <​0,​0,​0>,​ llGetRot(), 1);         llRezObject("​Object",​ pos, <​0,​0,​0>,​ llGetRot(), 1);
     }     }
Line 39: Line 39:
 ===== See also ===== ===== See also =====
  
-  * [[llRot2Left]] returns the local Y axis of a rotation. +  * $lfn[llRot2Left] returns the local Y axis of a rotation. 
-  * [[llRot2Up]] returns the local Z axis of a rotation. +  * $lfn[llRot2Up] returns the local Z axis of a rotation. 
-  * [[llAxes2Rot]] takes local X, Y, and Z unit vectors and converts them to a rotation.+  * $lfn[llAxes2Rot] takes local X, Y, and Z unit vectors and converts them to a rotation.