Difference between revisions of "LlGetAccel"

From Second Life Wiki
Jump to navigation Jump to search
(Undo revision 57841 by Asuka Neely (Talk))
Line 14: Line 14:
//If you ever want to actually stop an object, use llMoveToTarget(llGetPos(), .1)
//If you ever want to actually stop an object, use llMoveToTarget(llGetPos(), .1)
default {
default {
    state_entry() {
    moving_start(){  
          vector ac;
        vector ac;
          @loop { // Go forever
        // Go forever        
              if (llVecMag(ac = llGetAccel()) > .001) { //We're accelerating...
        while(llVecMag(ac = llGetAccel()) > .001) { //We're accelerating...
                    llApplyImpulse(-ac, 0) //Slow us down.
            llApplyImpulse(-ac, 0); //Slow us down.
              }
        }
          }jump loop;
    }
    }
}</lsl>
}</lsl>
|helpers
|helpers

Revision as of 04:06, 9 March 2008

Summary

Function: vector llGetAccel( );

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 {

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

See Also

Functions

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

Deep Notes

Search JIRA for related Issues

Signature

function vector llGetAccel();