Difference between revisions of "LlMoveToTarget"

From Second Life Wiki
Jump to navigation Jump to search
m (typo)
Line 4: Line 4:
|p1_type=vector|p1_name=target|p1_desc=[[Viewer coordinate frames#Region|region]] position
|p1_type=vector|p1_name=target|p1_desc=[[Viewer coordinate frames#Region|region]] position
|p2_type=float|p2_name=tau
|p2_type=float|p2_name=tau
|func_footnote=To stop the object from maintaining the '''target''' positions use {{LSLG|llStopMoveToTarget}}<br/>
|func_footnote=To stop the object from maintaining the '''target''' positions use [[llStopMoveToTarget]]<br/>
To change the rotation in the same manner use {{LSLG|llLookAt}} or {{LSLG|llRotLookAt}}.
To change the rotation in the same manner use [[llLookAt]] or [[llRotLookAt]].
|func_desc=Critically damp to '''target''' in '''tau''' seconds (if the script is physical)
|func_desc=Critically damp to '''target''' in '''tau''' seconds (if the script is physical)
|return_text
|return_text
Line 22: Line 22:
         llSleep(0.1);
         llSleep(0.1);
         llMoveToTarget(pos,0.4);
         llMoveToTarget(pos,0.4);
         // Look for owner within 20 metres in 360 degree arc every 1 seconds.
         // Look for owner within 20 meters in 360 degree arc every 1 seconds.
         llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0);
         llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0);
     }
     }
Line 38: Line 38:
</pre>
</pre>
|helpers
|helpers
|also_functions=*{{LSLG|llStopMoveToTarget}}
|also_functions={{LSL DefineRow||[[llStopMoveToTarget]]}}
*{{LSLG|llLookAt}}
{{LSL DefineRow||[[llLookAt]]}}
*{{LSLG|llRotLookAt}}
{{LSL DefineRow||[[llRotLookAt]]}}
*{{LSLG|llTarget}}
{{LSL DefineRow||[[llTarget]]}}
|also_tests
|also_tests
|also_events
|also_events

Revision as of 20:02, 8 August 2007

Summary

Function: llMoveToTarget( vector target, float tau );
0.0 Forced 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 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.

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

Signature

function void llMoveToTarget( vector target, float tau );