Difference between revisions of "LlGetRot"
Jump to navigation
Jump to search
All Issues ~ Search JIRA for related Bugs
Ramzi Linden (talk | contribs) m (minor rephrasing for clarity) |
Void Singer (talk | contribs) m (~caveats +useful-snippets workarounds for bugs) |
||
Line 9: | Line 9: | ||
|constants | |constants | ||
|spec | |spec | ||
|caveats | |caveats= | ||
* [[llGetRot]] incorrectly reports the avatars rotation when called from the root of an attached object, see [[llGetRot#Useful_Snippets|Useful Snippets]] for a workaround. | |||
|examples= | |examples= | ||
<lsl> //-- rotates an object to face the nearest cardinal direction (N,E,S,W) | <lsl> //-- rotates an object to face the nearest cardinal direction (N,E,S,W) | ||
Line 28: | Line 29: | ||
} | } | ||
}</lsl> | }</lsl> | ||
|helpers | |helpers= | ||
<lsl>//-- Workaround for attachment bug in root prims | |||
(rotation)((string)llGetPrimitiveParams( [PRIM_ROT_LOCAL] ))</lsl> | |||
|also_header | |also_header | ||
|also_functions= | |also_functions= | ||
Line 42: | Line 45: | ||
|also_articles | |also_articles | ||
|also_footer | |also_footer | ||
|notes= | |notes= | ||
The tooltip in the in-client editor is incorrect, it will work in scripts in objects that are physical. | * The tooltip in the in-client editor is incorrect, it will work in scripts in objects that are physical. | ||
|mode | |mode | ||
|deprecated | |deprecated |
Revision as of 04:28, 24 October 2010
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: rotation llGetRot( );62 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns a rotation that is the prim's rotation relative to the region's axes.
Caveats
- llGetRot incorrectly reports the avatars rotation when called from the root of an attached object, see Useful Snippets for a workaround.
Examples
<lsl> //-- rotates an object to face the nearest cardinal direction (N,E,S,W)
//-- assumes build is aligned to root object facing
default{
state_entry() { llSay( 0, "Rotate me in edit, then touch to make me face the nearest compass point" ); }
touch_start( integer vIntTouches ) { //-- convert our rotation to x/y/z radians vector vRadBase = llRot2Euler( llGetRot() ); //-- round the z-axis to the nearest 90deg (PI_BY_TWO = 90deg in radians) llSetRot( llEuler2Rot( <0.0, 0.0, llRound( vRadBase.z / PI_BY_TWO ) * PI_BY_TWO > ) ); }}</lsl>
Useful Snippets
<lsl>//-- Workaround for attachment bug in root prims (rotation)((string)llGetPrimitiveParams( [PRIM_ROT_LOCAL] ))</lsl>
Notes
- The tooltip in the in-client editor is incorrect, it will work in scripts in objects that are physical.
See Also
Functions
• | llGetLocalRot | |||
• | llGetRootRotation | |||
• | llGetPrimitiveParams | |||
• | llSetRot | |||
• | llSetLocalRot | |||
• | llSetPrimitiveParams | |||
• | llSetLinkPrimitiveParams |