Difference between revisions of "LlLookAt"

From Second Life Wiki
Jump to navigation Jump to search
(added example)
(1) restrictions on public domain content is contrary to the definition of public domain, 2) it goes against the editing guidelines of the wiki 3) attribution is handled by the history page)
Line 2: Line 2:
|func_id=105|func_sleep=0.0|func_energy=10.0
|func_id=105|func_sleep=0.0|func_energy=10.0
|func=llLookAt|p1_type=vector|p1_name=target|p2_type=float|p2_name=strength|p3_type=float|p3_name=damping
|func=llLookAt|p1_type=vector|p1_name=target|p2_type=float|p2_name=strength|p3_type=float|p3_name=damping
|func_footnote=To change the position in the same manner use {{LSLG|llMoveToTarget}}.
|func_footnote=To change the position in the same manner use [[llMoveToTarget]].
|func_desc=Cause object to point its' '''up''' axis (positive z) towards '''target'''
|func_desc=Cause object to point its' '''up''' axis (positive z) towards '''target'''


Continues to track '''target''' untill {{LSLG|llStopLookAt}} is called.
Continues to track '''target''' until [[llStopLookAt]] is called.
 
If the object isn't physical, the settings don't seem to have any effect except the force must be > 0. For physical objects, the strength seems to be something like viscosity, not the rotating strength, so the weaker it is the faster the rotation happens. The damping value controls how fast the rotation damps out. Low values relative to the strength make it bouncy, often overshooting the target, high values sluggish. The strength and damping values seem to have no relation to the mass of the object.
 
|return_text
|return_text
|spec
|spec=If the object isn't physical, the settings don't seem to have any effect except the force must be > 0. For physical objects, the strength seems to be something like viscosity, not the rotating strength, so the weaker it is the faster the rotation happens. The damping value controls how fast the rotation damps out. Low values relative to the strength make it bouncy, often overshooting the target, high values sluggish. The strength and damping values seem to have no relation to the mass of the object.
|caveats=This does not guarantee that physical objects will wind up pointing at the target. Depending on the shape of the object, the strength and the damping, it may well settle out at a different rotation pointing in a different direction if the damping stops the rotation before the final position is reached.


If the object is physical and not symmetrical it may cause a recoil effect where the object winds up drifting away from it's original position as well as making the final rotation it settles on less accurate.
|caveats=*There is no guarantee that the host objects will wind up pointing at the target. Depending on the shape of the object, the strength and the damping, it may well settle out at a different rotation pointing in a different direction if the damping stops the rotation before the final position is reached.
*If the host object is physical and not symmetrical it may cause a recoil effect where the object winds up drifting away from it's original position as well as making the final rotation it settles on less accurate.
|constants
|constants
|examples=
|examples=
<lsl>// Block Buddy
<lsl>//Causes Object to look at nearest Avatar.
// by Zand Gundersen
// Causes Object to look at nearest Avatar.
//
// THIS SCRIPT IS PUBLIC DOMAIN! Do not delete the credits at the top of this script!
// Feel free to copy, modify, and use this script.
 
default
default
{
{
     state_entry()
     state_entry()
     {
     {
         llSensorRepeat("",NULL_KEY,AGENT,20,PI,.2);
         llSensorRepeat("", "", AGENT, 20.0, PI, 0.2);
     }
     }


     sensor(integer total_number)
     sensor(integer total_number)
     {
     {
        if (total_number!=0)
         llLookAt( llDetectedPos(0) + <0.0, 0.0, 1.0>, 3.0, 1.0 );
         llLookAt( llDetectedPos(0)+<0,0,1>, 3, 1 );
     }
     }
}</lsl>
}</lsl>
|helpers
|helpers
|also_functions=
|also_functions=
*{{LSLG|llRotLookAt}}
{{LSL DefineRow||[[llRotLookAt]]}}
*{{LSLG|llStopLookAt}}
{{LSL DefineRow||[[llStopLookAt]]}}
|also_events
|also_events
|also_tests
|also_tests

Revision as of 21:12, 7 April 2008

Summary

Function: llLookAt( vector target, float strength, float damping );

Cause object to point its' up axis (positive z) 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

If the object isn't physical, the settings don't seem to have any effect except the force must be > 0. For physical objects, the strength seems to be something like viscosity, not the rotating strength, so the weaker it is the faster the rotation happens. The damping value controls how fast the rotation damps out. Low values relative to the strength make it bouncy, often overshooting the target, high values sluggish. The strength and damping values seem to have no relation to the mass of the object.

Caveats

  • There is no guarantee that the host objects will wind up pointing at the target. Depending on the shape of the object, the strength and the damping, it may well settle out at a different rotation pointing in a different direction if the damping stops the rotation before the final position is reached.
  • If the host object is physical and not symmetrical it may cause a recoil effect where the object winds up drifting away from it's original position as well as making the final rotation it settles on less accurate.
All Issues ~ Search JIRA for related Bugs

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

Search JIRA for related Issues

Signature

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