LlMoveToTarget

From Second Life Wiki

Jump to: navigation, search

Template:Needs Translation/LSL/de Template:Needs Translation/LSL/es Template:Needs Translation/LSL/el Template:Needs Translation/LSL/he Template:Needs Translation/LSL/it Template:Needs Translation/LSL/ko Template:Needs Translation/LSL/nl Template:Needs Translation/LSL/hu Template:Needs Translation/LSL/no Template:Needs Translation/LSL/da Template:Needs Translation/LSL/sv Template:Needs Translation/LSL/tr Template:Needs Translation/LSL/pl Template:Needs Translation/LSL/pt Template:Needs Translation/LSL/ru Template:Needs Translation/LSL/uk Template:Needs Translation/LSL/zh-Hans Template:Needs Translation/LSL/zh-Hant

Contents

Summary

Buggy
Function: llMoveToTarget( vector target, float tau );
70 Function ID
0.0 Delay
10.0 Energy

Critically damp to target in tau seconds (if the script is physical)

• vector target region position
• float tau seconds to critically damps in

To stop the object from maintaining the target positions use llStopMoveToTarget
To change the rotation in the same manner use llLookAt or llRotLookAt.

Caveats

  • Only works in attachments and physics-enabled objects.
  • When slowly moving to a lower Z value, beware of SVC-2441[c] - the sim will incorrectly move the object down faster than it should. That is, if you try moving to llGetPos() + <10, 10, -10>, you can end up at .z-10 several meters before getting to .x-10 and .y-10. There is a demo object in the JIRA which shows this effect.
  • A llMoveToTarget call seems to persist even if physics is turned off. This is a useful trick on sluggish sims where the object can drop a bit between the call to enable physics and the call to llMoveToTarget - just do the llMoveToTarget before setting the object to physical.
  • llVecDist(llGetPos(), target) must be less than 65, or no movement will occur.
  • Calling llMoveToTarget with a tau of 0.0 will silently fail, and do nothing.

Important Issues

~ Search JIRA for related Bugs
Bug - A problem which impairs or prevents the functions of the product. Open - The issue is open and ready for the assignee to start work on it.    Slowish llMoveToTarget path inconsistent when moving to a target at a -z position vs moving to +z

Examples

Drop this script in a prim to have it follow the prim owner.

 
default
{
    state_entry()
    {
        vector pos = llGetPos();
        llSetStatus(STATUS_PHYSICS, TRUE);
        // Little pause to allow server to make potentially large linked object physical.
        llSleep(0.1);
        llMoveToTarget(pos,0.4);
        // Look for owner within 20 meters in 360 degree arc every 1 seconds.
        llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0);
    }
    sensor(integer total_number)
    {
        // Get position of detected owner
        vector pos = llDetectedPos(0);
        // Offset back one metre in X and up one metre in Z based on world coordinates.
        // Offset relative to owner is possible but beyond the scope of this example.
        vector offset =<-1,0,1>;
        pos+=offset;
        llMoveToTarget(pos,0.4);     
    }
}
 

See Also

Functions

•  llStopMoveToTarget
•  llLookAt
•  llRotLookAt
•  llTarget

Deep Notes

Issues

~ Search JIRA for related Issues
Bug - A problem which impairs or prevents the functions of the product. Open - The issue is open and ready for the assignee to start work on it.    Slowish llMoveToTarget path inconsistent when moving to a target at a -z position vs moving to +z
This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.
Personal tools
In other languages