llLookAt

From Second Life Wiki
Revision as of 12:45, 19 March 2026 by Soap Frenzy (talk | contribs) (Modified spec and caveats to be more succinct)
Jump to navigation Jump to search

Summary

Function: llLookAt( vector target, float strength, float damping );
0.0 Forced Delay
10.0 Energy

Cause object to point its' forward axis (positive x) towards target

Continues to track target until llStopLookAt is called.

• vector target
• float strength
• float damping seconds to critically damp in

To change the position in the same manner use llMoveToTarget.

Specification

Strength is an inverse value meaning lower values cause the object to turn faster. Damping smooths the objects movements out preventing jitter or sharp movements. Object size, mass, and shape do not effect the function other than a large physical object that is resting on or colliding with other objects might not be able to turn correctly or fully.

Caveats

  • Object must be physical or this will do nothing.
  • Low strength values paired with low damping can cause the object to wobble and never fully face the target.

Examples

<lsl>//Causes Object to look at nearest Avatar. default {

   state_entry()
   {
       llSensorRepeat("", "", AGENT, 20.0, PI, 0.2);
   }
   sensor(integer total_number)
   {
       llLookAt( llDetectedPos(0) + <0.0, 0.0, 1.0>, 3.0, 1.0 );
   }
}</lsl>

See Also

Functions

•  llRotLookAt
•  llStopLookAt

Deep Notes

Signature

function void llLookAt( vector target, float strength, float damping );