Difference between revisions of "LlGetLocalRot"
Jump to navigation
Jump to search
m |
|||
(14 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LSL_Function | ||
|func_id=63|func_sleep=0.0|func_energy=10.0 | |||
|func=llGetLocalRot | |||
|return_type=rotation | |||
|func_footnote=If called from the root prim, it returns the objects rotation. | |||
|func_desc | |||
|Return_text=of the prim [[Viewer coordinate frames#Local|relative]] to the root. | |||
|spec | |||
|caveats | |||
|constants | |||
|examples= | |||
<source lang="lsl2"> | |||
//--// Door Script - Works At ANY Angle //--// | |||
//-- works in ANY single prim door, linked or un-linked | |||
//-- works in muti prim doors NOT linked to a larger structure | |||
//-- REQUIREMENTS: a cut root prim. Suggest cube, pathcut start=.125, end=.625 | |||
//-- CAVEAT: single prim doors are limited to 5m width | |||
//--// USERS MODIFY HERE v | |||
integer vgIntDoorSwing = 90; | |||
//-- use -# to reverse the direction of swing, eg. -90; | |||
rotation gRotDoorSwing; | |||
default{ | |||
state_entry(){ | |||
gRotDoorSwing = llEuler2Rot( <0.0, 0.0, vgIntDoorSwing> * DEG_TO_RAD ); | |||
} | |||
touch_start( integer vIntTouched ){ | |||
llSetLocalRot( (gRotDoorSwing = ZERO_ROTATION / gRotDoorSwing) * llGetLocalRot() ); | |||
} | |||
} | |||
</source> | |||
|helpers= | |||
<source lang="lsl2"> //-- this is an equivalent call from any prim in the same link set | |||
llList2Rot( llGetLinkPrimitiveParams( target_prim, [PRIM_ROT_LOCAL] ), 0 ) | |||
//-- where "target_prim" is the link number of the prim you want to get the local rotation of</source> | |||
|also_functions= | |||
{{LSL DefineRow||[[llGetRot]]|}} | |||
{{LSL DefineRow||[[llGetRootRotation]]|}} | |||
{{LSL DefineRow||[[llGetPrimitiveParams]]|}} | |||
{{LSL DefineRow||[[llGetLinkPrimitiveParams]]|}} | |||
{{LSL DefineRow||[[llSetRot]]|}} | |||
{{LSL DefineRow||[[llSetLocalRot]]|}} | |||
{{LSL DefineRow||[[llSetPrimitiveParams]]|}} | |||
{{LSL DefineRow||[[llSetLinkPrimitiveParams]]|}} | |||
{{LSL DefineRow||[[llSetLinkPrimitiveParamsFast]]|}} | |||
|also_events | |||
|also_tests | |||
|also_articles | |||
|notes=Returns the region relative rotation of the object if called from the root | |||
|permission | |||
|negative_index | |||
|sort=GetLocalRot | |||
|cat1=Movement | |||
|cat2=Rotation | |||
|cat3 | |||
|cat4 | |||
}} |
Latest revision as of 02:11, 22 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: rotation llGetLocalRot( );63 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns the rotation of the prim relative to the root.
If called from the root prim, it returns the objects rotation.
Caveats
Examples
//--// Door Script - Works At ANY Angle //--//
//-- works in ANY single prim door, linked or un-linked
//-- works in muti prim doors NOT linked to a larger structure
//-- REQUIREMENTS: a cut root prim. Suggest cube, pathcut start=.125, end=.625
//-- CAVEAT: single prim doors are limited to 5m width
//--// USERS MODIFY HERE v
integer vgIntDoorSwing = 90;
//-- use -# to reverse the direction of swing, eg. -90;
rotation gRotDoorSwing;
default{
state_entry(){
gRotDoorSwing = llEuler2Rot( <0.0, 0.0, vgIntDoorSwing> * DEG_TO_RAD );
}
touch_start( integer vIntTouched ){
llSetLocalRot( (gRotDoorSwing = ZERO_ROTATION / gRotDoorSwing) * llGetLocalRot() );
}
}
Useful Snippets
//-- this is an equivalent call from any prim in the same link set
llList2Rot( llGetLinkPrimitiveParams( target_prim, [PRIM_ROT_LOCAL] ), 0 )
//-- where "target_prim" is the link number of the prim you want to get the local rotation of
Notes
Returns the region relative rotation of the object if called from the root