24 May 2021
walkto (Commands) | |
---|---|
Type | Corrade progressive command |
Command | walkto |
Description | The walkto command makes Corrade walk towards a position in a given time duration while getting as close to the vicinity of the position as possible with a specified affinity . |
Permissions | movement |
Parameters | group , password , position |
Last Changes | C11 - added. |
The walkto
command makes Corrade walk towards a position
in a given time duration
while getting as close to the vicinity
of the position
as possible with a specified affinity
.
Command | Required Parameters | Required Corrade Permissions | Example |
---|---|---|---|
walkto | group , password , position | movement | llInstantMessage(CORRADE, wasKeyValueEncode( [ "command", "walkto", "group", wasURLEscape(GROUP), "password", wasURLEscape(PASSWORD), // walk to this object "position", llGetPos(), // accept a precision of 2 meters from the target "vicinity", 2, // give Corrade 10 seconds to arrive at this object "duration", 10000, "callback", wasURLEscape(URL) ] ) ); |
Optional Parameter | Possible Value | Description |
---|---|---|
duration | Time in milliseconds. | Allow duration for Corrade to reach position - otherwise, send an error to the callback indicating that Corrade has not properly reached its destination. |
vicinity | A range in meters (default 2 ). | If Corrade arrives in the vicinity of the position , consider that Corrade has arrived at the destination. |
affinity | An integer representing the affinity of the movement (default 2 ). | How precise should the movements be? |
Let's assume that Corrade can be seen abstractly as a box and that the destination is a primitive.
+-------+ +-------+ | C | | c | +-------+ +-------+ ^ ^ ^ ^ | | | | +---+ +---+ S s ^ ^ | | | +-------------------+ d ^^ || -- a
Every avatar in SecondLife has a centre and is surrounded by an invisible bounding box, the distance between the centre of the avatar and the side of the bounding box is . A box in SecondLife has a centre and a projection on one of its sides of distance .
The distance between the avatar and the box is given by where the distance includes the projection of the box and the size of the avatar bounding box . The actual distance between an avatar and the box is in fact because the distance is measured mathematically (or programatically using llVecDist
in LSL) as the distance between two points and .
The distance between and , namely can be decomposed in smaller, equally sized segments .
The definitions of duration
, vicinity
and affinity
are the following:
vicinity
is directly equal to the distance , affinity
is equal to the size of a smaller equally sized segment ,duration
is the maximal time required for the avatar to make the point equal to point (assuming that the primitive does not move).With the following observations:
vicinity
does not account of the avatar bounding box with a projection length of , nor the distance between the centre of the primitive and one of its sides such that we can say that the vicinity
must always be at least as large as for Corrade to ever be able to reach its destination within the allotted duration
.vicinity
parameter, V
is strictly smaller than plus , in other words , then Corrade will never be able to reach its destination and more than likely will swivel around until the duration
has elapsed; this happens because positions of objects are measured as point vectors in space that do not account for the "size" of the objects,affinity
parameter controls the amount of segments generated along the path , and is a form of fine grained control of the movement of Corrade along its trajectory; smaller values make Corrade take smaller steps and would appear as a more fluid motion, larger values make Corrade take larger strides making the movement seem more stridefulwalkto
is a blocking command that will return a success status via the callback when and if Corrade has reached the destination within the vicinity
. The distinction is that compared to autopilot
you should always install a callback and wait for confirmation before sending another walkto
command. If you do not wait for the callback, then Corrade will still be moving, such that sending a follow-up walkto
command will queue the command until the antecedent walkto
has completed and may lead to your workers being exceeded.walkto
is a reliable command that uses terse movements and bypasses the simulator pathfinding that might be broken on some grids (including SecondLife).