Difference between revisions of "LlMoveToTarget"

From Second Life Wiki
Jump to navigation Jump to search
(added SVC-2441 note)
m
Line 1: Line 1:
{{LSL Function/physical|avatar=*}}{{LSL Function/damping|tau}}{{LSL_Function
{{Issues/SVC-2441}}{{LSL Function/physical|avatar=*}}{{LSL Function/damping|tau}}{{LSL_Function
|func_id=70|func_sleep=0.0|func_energy=10.0
|func_id=70|func_sleep=0.0|func_energy=10.0
|func=llMoveToTarget
|func=llMoveToTarget
Line 45: Line 45:
|also_events
|also_events
|also_articles
|also_articles
|notes=When slowly moving to a lower Z value, beware of [http://jira.secondlife.com/browse/SVC-2441 SVC-2441] - 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.
|notes=When slowly moving to a lower Z value, beware of {{jira|SVC-2441}} - 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.


|cat1
|cat1

Revision as of 20:27, 23 April 2009

Summary

Function: llMoveToTarget( vector target, float tau );

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

• vector target region position
• float tau seconds to critically damp 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

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   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. <lsl> 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);     
   }

}

</lsl>

Notes

When slowly moving to a lower Z value, beware of SVC-2441 - 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.

See Also

Functions

•  llStopMoveToTarget
•  llLookAt
•  llRotLookAt
•  llTarget

Deep Notes

All Issues

~ Search JIRA for related Issues
   Slowish llMoveToTarget path inconsistent when moving to a target at a -z position vs moving to +z

Signature

function void llMoveToTarget( vector target, float tau );