Skip to main content

Module steering

Module steering 

Source
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§

ContextMap
Context steering maps: store interest and danger scores per direction slot. Useful for blending obstacle avoidance with goal seeking.
KinematicAgent
Simple kinematic character: instant velocity change (no forces).
PrioritySteeringCombiner
Apply behaviors in priority order; use the first one that produces a non-negligible force. Higher-indexed entries have lower priority.
SteeringAgent
An autonomous agent steered by force-based behaviors.
SteeringSystem
Manages a list of agents and updates them each frame.
WeightedSteering
Combine multiple steering behaviors using a weighted sum.

Enums§

SteeringBehavior
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 a and b.
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.