Expand description
Steering behaviors for autonomous agents.
Each behavior takes a SteeringAgent (and optional context) and returns
a Vec2 force. Forces are combined with WeightedSteering or
PrioritySteeringCombiner, then applied by SteeringSystem each frame.
§Example
use proof_engine::ai::steering::{SteeringAgent, seek, arrive, WeightedSteering, SteeringBehavior};
use glam::Vec2;
let agent = SteeringAgent::new(Vec2::new(0.0, 0.0), 5.0, 10.0);
let target = Vec2::new(10.0, 10.0);
let force = seek(&agent, target);
let mut ws = WeightedSteering::new();
ws.add(SteeringBehavior::Seek(target), 1.0);
ws.add(SteeringBehavior::Arrive { target, slow_radius: 3.0 }, 0.5);
let combined = ws.calculate(&agent, &[]);Structs§
- Context
Map - Context steering maps: store interest and danger scores per direction slot. Useful for blending obstacle avoidance with goal seeking.
- Kinematic
Agent - Simple kinematic character: instant velocity change (no forces).
- Priority
Steering Combiner - Apply behaviors in priority order; use the first one that produces a non-negligible force. Higher-indexed entries have lower priority.
- Steering
Agent - An autonomous agent steered by force-based behaviors.
- Steering
System - Manages a list of agents and updates them each frame.
- Weighted
Steering - Combine multiple steering behaviors using a weighted sum.
Enums§
- Steering
Behavior - All available steering behaviors as a tagged enum for use in combiners.
Functions§
- alignment
- Alignment: match heading with nearby agents.
- arrive
- Arrive: seek with deceleration inside
slow_radius. - clamp_
magnitude - cohesion
- Cohesion: steer toward the center of nearby agents.
- evade
- Evade: flee from the predicted future position of a threat.
- flee
- Flee: accelerate directly away from
threat. - interpose
- Interpose: steer to a position between two points
aandb. - leader_
following - Leader following: follow a leader while maintaining an offset.
- obstacle_
avoidance - Obstacle avoidance: steer around circular obstacles
(center, radius). - path_
following - Path following: stay on a path corridor.
- pursuit
- Pursuit: seek the predicted future position of a moving target.
- queue
- Queue: follow leader in a line (steer to stop if blocked by another agent ahead).
- seek
- Seek: accelerate directly toward
target. - separation
- Separation: maintain distance from nearby agents.
- wall_
avoidance - Wall avoidance: steer away from line-segment walls
(a, b). - wander
- Wander: random steering that produces smooth, organic movement.