Difference between revisions of "LlGetAccel"

From Second Life Wiki
Jump to navigation Jump to search
(Added Example)
Line 15: Line 15:
default {
default {
     state_entry() {
     state_entry() {
           while (1 == 1) { // Go forever
           vector ac;
               if (llVecMag(llGetAccel()) > .001) { //We're accelerating...
          @loop { // Go forever
                     llApplyImpulse(-llGetAccel(), 0) //Slow us down.
               if (llVecMag(ac = llGetAccel()) > .001) { //We're accelerating...
                     llApplyImpulse(-ac, 0) //Slow us down.
               }
               }
           }
           }jump loop;
     }
     }
}</pre>
}</pre>

Revision as of 13:44, 26 November 2007

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

//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;
     }
}

See Also

Functions

•  llGetOmega
•  llGetVel
•  llSetForce
•  llSetTorque
•  llSetForceAndTorque

Deep Notes

Signature

function vector llGetAccel();