Skip to main content

flee

Function flee 

Source
pub fn flee(
    name: &str,
    agent_pos_key: &str,
    threat_key: &str,
    speed: f32,
    safe_distance: f32,
) -> BehaviorNode
Expand description

Move the agent away from a threat position stored on the blackboard.

Reads:

  • "{agent_pos_key}" — current agent position (Vec3)
  • "{threat_key}" — threat position (Vec3)

Writes:

  • "{agent_pos_key}" — updated position

Succeeds when the agent is more than safe_distance away.