Steering class Gameplay kit

Mathematical steering force algorithms for autonomous NPCs, wildlife, and flocking.

Constructors

Steering()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

alignment(Vector3 currentVel, List<Vector3> neighborVelocities, {double maxSpeed = 5.0, double maxForce = 10.0}) → Vector3
Computes an alignment force steering towards the average velocity of neighborVelocities.
arrive(Vector3 currentPos, Vector3 currentVel, Vector3 targetPos, {double slowingRadius = 3.0, double maxSpeed = 5.0, double maxForce = 10.0}) → Vector3
Steers towards targetPos, decelerating smoothly inside slowingRadius.
cohesion(Vector3 currentPos, Vector3 currentVel, List<Vector3> neighborPositions, {double maxSpeed = 5.0, double maxForce = 10.0}) → Vector3
Computes a cohesion force steering towards the center of mass of neighborPositions.
flee(Vector3 currentPos, Vector3 currentVel, Vector3 threatPos, {double maxSpeed = 5.0, double maxForce = 10.0}) → Vector3
Computes a steering force directing the entity away from threatPos.
seek(Vector3 currentPos, Vector3 currentVel, Vector3 targetPos, {double maxSpeed = 5.0, double maxForce = 10.0}) → Vector3
Computes a steering force directing the entity towards targetPos.
separation(Vector3 currentPos, Vector3 currentVel, List<Vector3> neighbors, {double desiredDistance = 2.0, double maxSpeed = 5.0, double maxForce = 10.0}) → Vector3
Computes a separation steering force avoiding crowding nearby neighbors.
truncate(Vector3 vector, double max) → Vector3
Clamps the magnitude of vector to max.