Difference between revisions of "STATUS PHYSICS"
Jump to navigation
Jump to search
Fred Gandt (talk | contribs) (Added example and description.) |
|||
Line 3: | Line 3: | ||
|type=integer | |type=integer | ||
|value={{LSL Hex|0x1}} | |value={{LSL Hex|0x1}} | ||
|desc | |desc=This property if TRUE allows that the object is subject to and can offer physical interactions and forces. | ||
|examples | |examples=Simple script to turn on and off the physics of an object. | ||
<lsl>default | |||
{ | |||
state_entry() | |||
{ | |||
llSetTimerEvent(llFrand(10) + 5.0); // Set a random time in seconds between 5 and 15 | |||
} | |||
timer() | |||
{ | |||
if(!llGetStatus(STATUS_PHYSICS)) // Check the physical status is non-phys | |||
{ | |||
llSetStatus(STATUS_PHYSICS, TRUE); // Set the object physical | |||
llMoveToTarget(llGetPos() + <0.0,0.0,10.0>, 1.0); // Move to a point 10 meters above the present position | |||
} | |||
else // If physical | |||
{ | |||
llSetStatus(STATUS_PHYSICS, FALSE); // Set the object non-phys | |||
llSetTimerEvent(0.0); // Stop the timer | |||
} | |||
} | |||
}</lsl> | |||
|constants= | |constants= | ||
{{!}} | {{!}} |
Revision as of 02:41, 27 April 2010
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Description
Constant: integer STATUS_PHYSICS = 0x1;The integer constant STATUS_PHYSICS has the value 0x1
This property if TRUE allows that the object is subject to and can offer physical interactions and forces.
Caveats
Related Articles
Constants
|
Functions
• | llSetStatus | |||
• | llGetStatus |
Examples
Simple script to turn on and off the physics of an object. <lsl>default {
state_entry() { llSetTimerEvent(llFrand(10) + 5.0); // Set a random time in seconds between 5 and 15 } timer() { if(!llGetStatus(STATUS_PHYSICS)) // Check the physical status is non-phys { llSetStatus(STATUS_PHYSICS, TRUE); // Set the object physical llMoveToTarget(llGetPos() + <0.0,0.0,10.0>, 1.0); // Move to a point 10 meters above the present position } else // If physical { llSetStatus(STATUS_PHYSICS, FALSE); // Set the object non-phys llSetTimerEvent(0.0); // Stop the timer } }
}</lsl>