Difference between revisions of "LlGetAccel"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(14 intermediate revisions by 8 users not shown)
Line 4: Line 4:
|func_footnote
|func_footnote
|func_desc
|func_desc
|return_text=that is the acceleration of the object expressed as a {{LSLG|global vector}}.
|return_text=that is the acceleration of the object in the [[Viewer coordinate frames#Region|region]] frame of reference.
|spec
|spec
|caveats
|caveats=
*Returns [[ZERO_VECTOR]] in attachments regardless of the avatar's acceleration.
*Returns [[ZERO_VECTOR]] in child prims regardless of the linkset's acceleration.
|constants
|constants
|examples
|examples=
<source lang="lsl2">
//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.
        }
    }
}</source>
|helpers
|helpers
|also_functions=
|also_functions=
{{LSL DefineRow||[[llGetOmega]]|}}
{{LSL DefineRow||[[llGetOmega]]|}}
{{LSL DefineRow||[[llGetVel]]|}}
{{LSL DefineRow||[[llGetVel]]|}}
{{LSL DefineRow||[[llGetTorque]]|}}
{{LSL DefineRow||[[llGetMass]]|}}
{{LSL DefineRow||[[llGetForce]]|}}
{{LSL DefineRow||[[llSetForce]]|}}
{{LSL DefineRow||[[llSetForce]]|}}
{{LSL DefineRow||[[llSetTorque]]|}}
{{LSL DefineRow||[[llSetTorque]]|}}
Line 24: Line 42:
|cat1=Physics
|cat1=Physics
|cat2=Movement
|cat2=Movement
|cat3
|cat3=Vehicle
|cat4
|cat4
}}
}}

Latest revision as of 01:31, 22 January 2015

Summary

Function: vector llGetAccel( );

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

Caveats

  • Returns ZERO_VECTOR in attachments regardless of the avatar's acceleration.
  • Returns ZERO_VECTOR in child prims regardless of the linkset's acceleration.
All Issues ~ Search JIRA for related Bugs

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

See Also

Functions

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

Deep Notes

Search JIRA for related Issues

Signature

function vector llGetAccel();