Difference between revisions of "LlGetAccel"

From Second Life Wiki
Jump to navigation Jump to search
m
m (formatted example)
Line 9: Line 9:
|constants
|constants
|examples=
|examples=
<pre>
<lsl>
//A very simple (and not very effective) way of keeping a physical object in place.
//A very simple (and not very effective) way of keeping a physical object in place.
//If the object is moving when the script is put in the object, then the object will continue to move, so long as it doesn't accelerate.  
//If the object is moving when the script is put in the object, then the object will continue to move, so long as it doesn't accelerate.  
Line 22: Line 22:
           }jump loop;
           }jump loop;
     }
     }
}</pre>
}</lsl>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 15:28, 18 February 2008

Summary

Function: vector llGetAccel( );
0.0 Forced Delay
10.0 Energy

Returns a vector that is the acceleration of the object in the region frame of reference.

Examples

<lsl> //A very simple (and not very effective) way of keeping a physical object in place. //If the object is moving when the script is put in the object, then the object will continue to move, so long as it doesn't accelerate. //If you ever want to actually stop an object, use llMoveToTarget(llGetPos(), .1) default {

    state_entry() {
         vector ac;
         @loop { // Go forever
              if (llVecMag(ac = llGetAccel()) > .001) { //We're accelerating...
                   llApplyImpulse(-ac, 0) //Slow us down.
              }
         }jump loop;
    }
}</lsl>

See Also

Functions

•  llGetOmega
•  llGetVel
•  llGetTorque
•  llGetMass
•  llGetForce
•  llSetForce
•  llSetTorque
•  llSetForceAndTorque

Deep Notes

Signature

function vector llGetAccel();