Difference between revisions of "LlMoveToTarget"
Jump to navigation
Jump to search
(<lsl> example) |
|||
Line 12: | Line 12: | ||
|constants | |constants | ||
|examples=Drop this script in a prim to have it follow the prim owner. | |examples=Drop this script in a prim to have it follow the prim owner. | ||
< | <lsl> | ||
default | default | ||
{ | { | ||
Line 36: | Line 36: | ||
} | } | ||
} | } | ||
</ | </lsl> | ||
|helpers | |helpers | ||
|also_functions={{LSL DefineRow||[[llStopMoveToTarget]]}} | |also_functions={{LSL DefineRow||[[llStopMoveToTarget]]}} |
Revision as of 05:09, 27 April 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: llMoveToTarget( vector target, float tau );70 | Function ID |
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.
Caveats
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>See Also
Functions
• | llStopMoveToTarget | |||
• | llLookAt | |||
• | llRotLookAt | |||
• | llTarget |