llApplyImpulse

From Second Life Wiki
Revision as of 12:16, 28 November 2007 by Xaviar Czervik (talk | contribs) (Last edit destroyed template. Fixed.)
Jump to navigation Jump to search

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 instead of region directional vector.

Caveats

  • Object must be physical.
All Issues ~ Search JIRA for related Bugs

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

Search JIRA for related Issues

Signature

function void llApplyImpulse( vector force, integer local );