Walk to a Local Position

24 May 2021

  • C11 - added.
walkto (Commands)
TypeCorrade progressive command
Commandwalkto
DescriptionThe 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.
Permissionsmovement
Parametersgroup, password, position
Last ChangesC11 - 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?

Duration, Vicinity, Affinity

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 $C$ and is surrounded by an invisible bounding box, the distance between the centre $C$ of the avatar and the side of the bounding box is $S$. A box in SecondLife has a centre $c$ and a projection on one of its sides of distance $s$.

The distance between the avatar and the box is given by $d$ where the distance $d$ includes the projection of the box $s$ and the size of the avatar bounding box $S$. The actual distance between an avatar and the box is in fact $D=d-S-s$ because the distance is measured mathematically (or programatically using llVecDist in LSL) as the distance between two points $C$ and $c$.

The distance between $C$ and $c$, namely $d$ can be decomposed in smaller, equally sized segments $a$.

The definitions of duration, vicinity and affinity are the following:

  • the vicinity is directly equal to the distance $d$,
  • the affinity is equal to the size of a smaller equally sized segment $a$,
  • the duration is the maximal time required for the avatar to make the point $C$ equal to point $c$ (assuming that the primitive does not move).

With the following observations:

  • the vicinity does not account of the avatar bounding box with a projection length of $S$, nor the distance between the centre of the primitive $c$ and one of its sides $s$ such that we can say that the vicinity must always be at least as large as $S+s$ for Corrade to ever be able to reach its destination within the allotted duration.
    • conversely, iff. the vicinity parameter, V is strictly smaller than $S$ plus $s$, in other words $V < S+s$, 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,
  • the affinity parameter controls the amount of segments generated along the path $d$, 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 strideful

Notes

  • Compared to autopilot, walkto 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.
  • Compared to autopilot, walkto is a reliable command that uses terse movements and bypasses the simulator pathfinding that might be broken on some grids (including SecondLife).

secondlife/scripted_agents/corrade/api/commands/walkto.txt ยท Last modified: 2021/12/01 20:57 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy, copyright and the plagiarism pages.