Difference between revisions of "LlGetAccel"
Jump to navigation
Jump to search
All Issues ~ Search JIRA for related Bugs
m |
|||
(23 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LSL_Function | ||
|func_id=78|func_sleep=0.0|func_energy=10.0 | |||
|func=llGetAccel|return_type=vector | |||
|func_footnote | |||
|func_desc | |||
|return_text=that is the acceleration of the object in the [[Viewer coordinate frames#Region|region]] frame of reference. | |||
|spec | |||
|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 | |||
|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 | |||
|also_functions= | |||
{{LSL DefineRow||[[llGetOmega]]|}} | |||
{{LSL DefineRow||[[llGetVel]]|}} | |||
{{LSL DefineRow||[[llGetTorque]]|}} | |||
{{LSL DefineRow||[[llGetMass]]|}} | |||
{{LSL DefineRow||[[llGetForce]]|}} | |||
{{LSL DefineRow||[[llSetForce]]|}} | |||
{{LSL DefineRow||[[llSetTorque]]|}} | |||
{{LSL DefineRow||[[llSetForceAndTorque]]|}} | |||
|also_events | |||
|also_tests | |||
|also_articles | |||
|notes | |||
|permission | |||
|negative_index | |||
|cat1=Physics | |||
|cat2=Movement | |||
|cat3=Vehicle | |||
|cat4 | |||
}} |
Latest revision as of 01:31, 22 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector llGetAccel( );78 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
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.
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 |