Skip to content

llGetAccel

vector llGetAccel()

Returns the acceleration of the object relative to the region's axes.

Gets the acceleration of the object.

  • Returns ZERO_VECTOR in attachments regardless of the avatar’s acceleration
  • Returns ZERO_VECTOR in child prims regardless of the linkset’s acceleration

A simple way to help keep a physical object in place by counteracting acceleration:

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