Difference between revisions of "LlGetRot"
Jump to navigation
Jump to search
m (Linked to Prim) |
Ramzi Linden (talk | contribs) m (minor rephrasing for clarity) |
||
Line 6: | Line 6: | ||
|func_footnote | |func_footnote | ||
|return_type=rotation | |return_type=rotation | ||
|return_text=that is the prim's rotation relative to the [[Viewer coordinate frames#Region|region]] | |return_text=that is the prim's rotation relative to the [[Viewer coordinate frames#Region|region]]'s axes. | ||
|constants | |constants | ||
|spec | |spec |
Revision as of 12:05, 28 September 2009
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
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>
Notes
llGetRot in Mouselook (see llForceMouselook) for an attachment returns the angle the avatar is looking in. 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 |