Class SteeringSolver
Computes a final steering direction by passing the raw desired-direction vector through an ordered chain of SteeringBehaviour handlers.
public class SteeringSolver : MonoBehaviour
Inheritance
Examples
// Assign behaviours (e.g. SeekBehavior, ObstacleAvoidanceBehavior) in the Inspector,
// then query the composite steering vector from a controller:
Vector3 desiredDirection = (destination - transform.position).normalized;
Vector3 steeredDirection = steeringSolver.GetSteering(desiredDirection);
rigidbody.velocity = steeredDirection * maxSpeed;
Remarks
Each SteeringBehaviour in behaviours receives the vector produced by its predecessor and returns a modified version. Order matters — placing seek first establishes a goal-directed base vector, and obstacle avoidance placed after it deflects that vector away from hazards rather than starting from scratch. Rearranging the array in the Inspector changes which forces take precedence without touching any behaviour class.
The solver itself does not apply any physics; it simply returns the final composite direction. The caller (typically a vehicle controller or path-follow component) is responsible for scaling the result by max speed and writing it to the Rigidbody.
Fields
Rigidbody
The Rigidbody component of the object, used for physics-based movement.
public Rigidbody Rigidbody
Field Value
Properties
MaxSpeed
The actor's current maximum speed in m/s, or null if the actor does not implement
IMaxSpeedProvider.
public float? MaxSpeed { get; }
Property Value
float?
Remarks
Nullable so that behaviours can distinguish "speed not available" from "speed is zero".
A behaviour that needs speed for normalisation should check for null before using
this value.
Methods
GetSteering(Vector3)
Passes DesiredVector through every behaviour in the chain and returns
the final composite steering direction.
public Vector3 GetSteering(Vector3 DesiredVector)
Parameters
| Name | Type | Description |
|---|---|---|
DesiredVector | Vector3 | The initial goal direction, typically (destination - transform.position).normalized. |
Returns
Vector3 — The final direction after all behaviour modifications have been applied.
Remarks
The chain is purely additive/transformative — each behaviour receives the output of the
previous one and may deflect, scale, or replace it. If any behaviour reference in the
array is null (e.g., an Inspector slot left empty), a warning is logged and that
slot is skipped rather than throwing, so the chain degrades gracefully.