llWanderWithin
void llWanderWithin(vector Origin, vector Area, list Options)Wander within a specified volume.
Sets a character to wander about a central spot within a specified area.
Parameters
-
Origin(vector) - Central point to wander about.
-
Area(vector) - Half-extents of an area the character may wander within. (i.e., it can wander from the specified origin by up to +/-Distance.x in x, +/-Distance.y in y, etc.)
-
Options(list) - No options available at this time.
default{ state_entry() { llCreateCharacter([CHARACTER_MAX_SPEED, 25, CHARACTER_DESIRED_SPEED, 15.0]); //MAX_SPEED is @ 20 by default }
touch_start(integer total_number) { llWanderWithin(llGetPos(), <10.0, 10.0, 5.0>, [WANDER_PAUSE_AT_WAYPOINTS, TRUE]); }}Caveats
Section titled “Caveats”- Must use
llCreateCharacteror script won’t compile. - Wander area is a rough area based on the specified origin, to a specified scale on each axis. So, if
<20, 10, 2>is specified the object will wander within 20m along the world x-axis, 10m along the world y-axis, and 2m along the world z-axis.- If
disthas any dimension less than 1.0, an error is shouted onDEBUG_CHANNEL: “Scale too small. All dimensions must be at least 1.0.”
- If
- When
WANDER_PAUSE_AT_WAYPOINTSis enabled,PU_GOAL_REACHEDandPU_SLOWDOWN_DISTANCE_REACHEDpath_updateevents will be triggered when approaching each waypoint. When this flag is disabled, the aforementioned path_update events will not be triggered when arriving at waypoints. - Wander area can be limited to a smaller area by introducing obstacles such as walls.
- Vertical positions specified for any vectors should be chosen to be as close as possible to the actual height of the terrain requested. Large difference between the provided vertical position and the actual terrain/object will result in failure of the behavior.
- As for all pathfinding behaviors, do not rely on the detailed implementation. The wander distance is just a rough estimate. The exact shape may change. Do not make this another PATHBUG-69.