Skip to main content

patrol_set_target

Function patrol_set_target 

Source
pub fn patrol_set_target(
    name: &str,
    waypoints: Vec<Vec3>,
    waypoint_idx_key: &str,
    agent_pos_key: &str,
    target_pos_key: &str,
    arrival_radius: f32,
) -> BehaviorNode
Expand description

Move through a fixed list of waypoints in a loop.

Stores current waypoint index in "{waypoint_idx_key}". Writes the next target to "{target_pos_key}" and then delegates movement to the blackboard consumer (i.e. pair this with move_to).

On each tick:

  1. Load current waypoint index from "{waypoint_idx_key}" (default 0).
  2. Write that waypoint’s Vec3 into "{target_pos_key}".
  3. If agent is within arrival_radius, advance the index and return Running.
  4. Otherwise return Running (movement handled externally).