
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- Repository
- thedivergentai/Game-Dev-Agentic-Skills917
- 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
Resourceyou define. No navigation resource was opened. - Systems: read the mode and write a desired velocity or waypoint on
UpdateorFixed. Use.chain()so policy runs before movement. Do not call an agent callback that writesTransform. - Schedule:
Fixed/FixedMainwhen the result feeds the movement step.
Policy map
| Need | Owner |
|---|---|
| Chase vs patrol vs wait | Enum Component plus a system that writes Goal |
| Retarget throttle | Timer resource ticked on FixedUpdate |
| Crowd and avoidance | bevy-navigation |
| Bake and obstacles | bevy-navigation |
| Line of sight | bevy-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);
