llApplyImpulse

From Second Life Wiki
Revision as of 11:13, 28 November 2007 by Xaviar Czervik (talk | contribs) (Added Example)
Jump to navigation Jump to search

Summary

Function: llApplyImpulse( vector force, integer local );
0.0 Forced Delay
10.0 Energy

Applies impulse to object

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

Caveats

  • Object must be physical.

Examples

//Rez a physical object, and drop this script in it.
//This will launch the box at the closest person around.
//Adding llSetDamage(1000.0) would make this similar to an autokiller.
default {
     state_entry() {
          llSensor("", "", AGENT, 1000, 1000);
     }
     sensor(integer num) {
          vector pos = llDetectedPos(0); //Their pos
          vector diff = pos-llGetPos();
          diff = diff/llVecMag(diff); //Make this a unit vector.
          llApplyImpulse(diff*10000, 0); //Launches the object at the person.
          llApplyImpulse(diff*10000, 0); //Launches the object at the person.
          llApplyImpulse(diff*10000, 0); //Launches the object at the person.
          llApplyImpulse(diff*10000, 0); //Launches the object at the person.
     }
     no_sensor() {
          llOwnerSay("No agents detected within 96m");
     }
}

See Also

Functions

•  llApplyRotationalImpulse

Deep Notes

Signature

function void llApplyImpulse( vector force, integer local );