Difference between revisions of "LlWanderWithin"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 6: Line 6:
p1_name=origin|
p1_name=origin|
p1_desc=Central point to wander about.|
p1_desc=Central point to wander about.|
p2_type=float|
p2_type=vector|
p2_name=dist|
p2_name=dist|
p2_desc=Sets how far the character may wander from ''origin''.|
p2_desc=Sets how far the character may wander from ''origin'', along each world-aligned axis|
p3_type=list|
p3_type=list|
p3_name=options|
p3_name=options|
Line 14: Line 14:
caveats=
caveats=
* Must use llCreateCharacter or script won't compile.
* Must use llCreateCharacter or script won't compile.
* Wander area is a rough area based on the specified origin, to a specified radius. So, if 10.0m is specified the object will wander within an area 20m to a side, centered on origin.
* Wander area is a rough area based on the specified origin, to a specified scale on each axis. So, if <20, 10, 2>m 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.
* Wander area can be limited to a smaller area by introducing obstacles such as walls.
* 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.
* 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.
Line 30: Line 30:
     touch_start(integer total_number)
     touch_start(integer total_number)
     {
     {
         llWanderWithin(llGetPos(), 10.0, []);
         llWanderWithin(llGetPos(), <10.0, 10.0, 5.0>, []);
     }
     }
}
}

Revision as of 11:22, 9 May 2012

Summary

Function: llWanderWithin( vector origin, vector dist, list options );

Sets a character to wander about a central spot within a specified radius.

• vector origin Central point to wander about.
• vector dist Sets how far the character may wander from origin, along each world-aligned axis
• list options No options available at this time.

Caveats

  • Must use llCreateCharacter or 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>m 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.
  • 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 here. The wander distance is just a rough estimate. We may change the exact shape on a whim. For fun. Or because it seems better that way. Or to ensure that you aren't relying on the detailed implementation. Don't make this another PATHBUG-69. :)
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> 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>, []);
   }

}

</lsl>

Deep Notes

Search JIRA for related Issues

Signature

function void llWanderWithin( vector origin, vector dist, list options );