Skills

Bevy AI Navigation

Bevy 0.20 chase, patrol, and wait policy: an enum brain, a goal, a desired velocity...

Install

npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-ai-navigation -g -a claude-code -y
Category
Engineering
Updated
19d ago
License
LGPL-3.0
Context cost
Mediumabout 2,141 tokens
Runs scripts
No, instructions only

What it does

Bevy 0.20 chase, patrol, and wait policy: an enum brain, a goal, a desired velocity, and a retarget timer on FixedUpdate. Use when an actor must choose a goal before movement. Paths stay on bevy-navigation. Keywords: Brain, Goal, DesiredVelocity, PatrolRoute, FixedUpdate, chase, patrol.

Bevy AI navigation

When to use

Load this when an actor must chase, patrol, or wait. This skill owns the intent and the desired velocity. Paths stay on bevy-navigation. Transform integration stays on bevy-character-movement. Line-of-sight sensors stay on bevy-spatial-queries.

ECS shape

  • Components: a mode flag can be an enum Component (see bevy-state-machines for the pattern). Goal position can be your own component. No agent, radius, or layer type was opened.
  • Resources: a shared patrol table can be a Resource you define. No navigation resource was opened.
  • Systems: read the mode and write a desired velocity or waypoint on Update or Fixed. Use .chain() so policy runs before movement. Do not call an agent callback that writes Transform.
  • Schedule: Fixed / FixedMain when the result feeds the movement step.

Policy map

NeedOwner
Chase vs patrol vs waitEnum Component plus a system that writes Goal
Retarget throttleTimer resource ticked on FixedUpdate
Crowd and avoidancebevy-navigation
Bake and obstaclesbevy-navigation
Line of sightbevy-spatial-queries

Policy writes DesiredVelocity. It does not move Transform and it does not query a navmesh.

[dependencies]
bevy = "0.20"
#[derive(Clone, Copy, PartialEq, Eq, Component)]
enum Brain {
    Wait,
    Patrol,
    Chase,
}

#[derive(Component)]
struct WaypointIndex(usize);

#[derive(Component)]
struct Goal(Vec3);

#[derive(Component)]
struct DesiredVelocity(Vec3);

#[derive(Component)]
struct Player;

#[derive(Resource)]
struct PatrolRoute {
    points: Vec<Vec3>,
}

#[derive(Resource)]
struct RetargetClock(Timer);
Read the whole SKILL.md on GitHub

More in Engineering