Difference between revisions of "LlApplyImpulse"

From Second Life Wiki
Jump to navigation Jump to search
m (Turned magnitude into a link to llVecMag)
m (some day i'll write a good description for the force parameter, until then...)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{LSL_Function/force|force|local=local}}{{LSL_Function/physical}}
|func=llApplyImpulse
|func=llApplyImpulse
|sort=ApplyImpulse
|sort=ApplyImpulse
Line 7: Line 8:
|p2_type=integer
|p2_type=integer
|p2_name=local
|p2_name=local
|p2_hover=boolean, if TRUE, force is treated as a local directional vector instead of region directional vector.
|p2_hover=boolean, if TRUE, 'force' is treated as a local directional vector instead of region directional vector.
|p2_desc=boolean, if [[TRUE]], '''force''' is treated as a [[Viewer coordinate frames#Local|local]] directional vector instead of [[Viewer coordinate frames#Region|region]] directional vector.
|p2_desc=boolean, if [[TRUE]], {{LSLP|force}} is treated as a [[Viewer coordinate frames#Local|local]] directional vector instead of [[Viewer coordinate frames#Region|region]] directional vector.
|func_footnote=Instantaneous impulse. [[llSetForce]] has continuous push. "Instantaneous" seems to mean a one second impulse, as an application of a force (in newtons) equal to the object's mass (in kg) for one second will accelerate it to a velocity of 1 (in meters per second), which appears to be what happens with this function.
|func_footnote=Instantaneous impulse. [[llSetForce]] has continuous push. "Instantaneous" seems to mean a one second impulse, as an application of a force (in newtons) equal to the object's mass (in kg) for one second will accelerate it to a velocity of 1 (in meters per second), which appears to be what happens with this function.
|func_desc=Applies impulse to object
|func_desc=Applies impulse to object
|return_text|spec
|return_text|spec
|caveats=*Object must be physical.
|caveats=
*The force [[llVecMag|magnitude]] is capped at 20.000.
*The [[llVecMag|magnitude]] of {{LSLP|force}} may be scaled back by the object's available energy.
*The force magnitude is scaled by the object's energy.
*The maximum magnitude of {{LSLP|force}} is 20.0 and if it exceeds that it will be scaled back.
|examples=
|examples=
<lsl>
<lsl>

Revision as of 12:46, 10 June 2012

Summary

Function: llApplyImpulse( vector force, integer local );

Applies impulse to object

• vector force
• integer local boolean, if TRUE force is treated as a local directional vector, if FALSE force is treated as a region directional vectorboolean, if TRUE, force is treated as a local directional vector instead of region directional vector.

Instantaneous impulse. llSetForce has continuous push. "Instantaneous" seems to mean a one second impulse, as an application of a force (in newtons) equal to the object's mass (in kg) for one second will accelerate it to a velocity of 1 (in meters per second), which appears to be what happens with this function.

Caveats

  • Only works in physics-enabled objects.
  • The magnitude of force may be scaled back by the object's available energy.
  • The maximum magnitude of force is 20.0 and if it exceeds that it will be scaled back.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> //Rez an object, and drop this script in it. //This will launch it at the owner. default {

    state_entry() {
         list p = llGetObjectDetails(llGetOwner(), [OBJECT_POS]);
         if(p != []) {
             llSetStatus(STATUS_PHYSICS, TRUE);
             vector pos = llList2Vector(p, 0);
             vector direction = llVecNorm(pos - llGetPos());
             llApplyImpulse(direction * 100, 0);
         }
    }

}

</lsl>

See Also

Functions

•  llApplyRotationalImpulse
•  llSetForce Set continuous force

Deep Notes

Search JIRA for related Issues

Signature

function void llApplyImpulse( vector force, integer local );