C# Class Indiefreaks.Xna.Logic.Steering.SteeringLibrary

This static class implements all the Steering Behaviors actual algorithms
Datei anzeigen Open project: Indiefreaks/igf Class Usage Examples

Public Methods

Method Description
Alignment ( Vector3 entityForward, List agentForwards, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to align the current agent with a list of other agents

Arrive ( Vector3 position, Vector3 destination, float deceleration, Vector3 velocity, float maxSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move towards a position and decelerate when getting close to it

Cohesion ( Vector3 entityPosition, Vector3 entityVelocity, float entityMaxSpeed, List agentPositions, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move closer to a list of agents

Evade ( Vector3 evaderPosition, Vector3 evaderVelocity, float evaderMaxSpeed, Vector3 pursuerPosition, Vector3 pursuerVelocity, float pursuerMaxSpeed, float panicDistance, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move away from a given agent using prediction

Flee ( Vector3 position, Vector3 target, float panicDistance, Vector3 velocity, float maxSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move away from a given position

Interpose ( Vector3 entityPosition, Vector3 entityVelocity, Vector3 agentAPosition, Vector3 agentAVelocity, Vector3 agentBPosition, Vector3 agentBVelocity, float entityMaxSpeed, float entityDeceleration, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to place the agent in between two targets

ObstacleAvoidance ( Vector3 obstacleLocalPosition, float obstacleBoundsRadius, float detectionBoxLength, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move away from a given obstacle

ObstacleAvoidanceNew ( Vector3 entityPosition, Vector3 obstaclePosition, Vector3 obstacleForward, Vector3 forceInfluence, Vector3 &steeringForce ) : void
OffsetPursuit ( Vector3 entityPosition, Vector3 entityVelocity, float entityMaxSpeed, float entityDeceleration, Vector3 leaderVelocity, float leaderMaxSpeed, Vector3 worldOffsetPosition, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move towards an agent predicted position with an offset

Pursuit ( Vector3 pursuerPosition, Vector3 pursuerForward, Vector3 pursuerVelocity, float pursuerMaxSpeed, Vector3 evaderPosition, Vector3 evaderForward, Vector3 evaderVelocity, float evaderSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move behind a given agent using prediction

Seek ( Vector3 position, Vector3 target, Vector3 velocity, float maxSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move towards a destination

Separation ( Vector3 entityPosition, List agentPositions, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that tends to move away from a list of other agents

Wander ( Random dice, Vector3 position, Vector3 velocity, Vector3 entityForward, Vector3 &wanderTarget, float wanderRadius, float wanderDistance, float wanderJitter, float maxSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void

Creates a force that randomly moves a given agent

Method Details

Alignment() public static method

Creates a force that tends to align the current agent with a list of other agents
public static Alignment ( Vector3 entityForward, List agentForwards, Vector3 forceInfluence, Vector3 &steeringForce ) : void
entityForward Vector3 Current agent forward vector
agentForwards List Considered agent forward vectors
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Arrive() public static method

Creates a force that tends to move towards a position and decelerate when getting close to it
public static Arrive ( Vector3 position, Vector3 destination, float deceleration, Vector3 velocity, float maxSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void
position Vector3 Current position of the agent
destination Vector3 Current position of the destination
deceleration float Deceleration factor applied when reaching close to destination
velocity Vector3 Current velocity of the agent
maxSpeed float Current maximum speed of the agent
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Cohesion() public static method

Creates a force that tends to move closer to a list of agents
public static Cohesion ( Vector3 entityPosition, Vector3 entityVelocity, float entityMaxSpeed, List agentPositions, Vector3 forceInfluence, Vector3 &steeringForce ) : void
entityPosition Vector3 Current agent position
entityVelocity Vector3 Current agent velocity
entityMaxSpeed float Current agent maximum speed
agentPositions List Considered agent positions
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Evade() public static method

Creates a force that tends to move away from a given agent using prediction
public static Evade ( Vector3 evaderPosition, Vector3 evaderVelocity, float evaderMaxSpeed, Vector3 pursuerPosition, Vector3 pursuerVelocity, float pursuerMaxSpeed, float panicDistance, Vector3 forceInfluence, Vector3 &steeringForce ) : void
evaderPosition Vector3 Current agent position
evaderVelocity Vector3 Current agent velocity
evaderMaxSpeed float Current agent maximum speed
pursuerPosition Vector3 Threatening agent position
pursuerVelocity Vector3 Threatening agent velocity
pursuerMaxSpeed float Threatening agent maximum speed
panicDistance float Agent's distance from which the threat should be considered
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Flee() public static method

Creates a force that tends to move away from a given position
public static Flee ( Vector3 position, Vector3 target, float panicDistance, Vector3 velocity, float maxSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void
position Vector3 Current position of the agent
target Vector3 Current position of the threat
panicDistance float Agent's distance from which the threat should be considered
velocity Vector3 Current velocity of the agent
maxSpeed float Current maximum speed of the agent
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Interpose() public static method

Creates a force that tends to place the agent in between two targets
public static Interpose ( Vector3 entityPosition, Vector3 entityVelocity, Vector3 agentAPosition, Vector3 agentAVelocity, Vector3 agentBPosition, Vector3 agentBVelocity, float entityMaxSpeed, float entityDeceleration, Vector3 forceInfluence, Vector3 &steeringForce ) : void
entityPosition Vector3 Current agent position
entityVelocity Vector3 Current agent velocity
agentAPosition Vector3 First agent position
agentAVelocity Vector3 First agent velocity
agentBPosition Vector3 Second agent position
agentBVelocity Vector3 Second agent velocity
entityMaxSpeed float Current agent maximum speed
entityDeceleration float Deceleration used when getting close to interpose
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

ObstacleAvoidance() public static method

Creates a force that tends to move away from a given obstacle
public static ObstacleAvoidance ( Vector3 obstacleLocalPosition, float obstacleBoundsRadius, float detectionBoxLength, Vector3 forceInfluence, Vector3 &steeringForce ) : void
obstacleLocalPosition Vector3 Obstacle local space position
obstacleBoundsRadius float Obstacle bounding radius
detectionBoxLength float Length of detection sensor
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

ObstacleAvoidanceNew() public static method

public static ObstacleAvoidanceNew ( Vector3 entityPosition, Vector3 obstaclePosition, Vector3 obstacleForward, Vector3 forceInfluence, Vector3 &steeringForce ) : void
entityPosition Vector3
obstaclePosition Vector3
obstacleForward Vector3
forceInfluence Vector3
steeringForce Vector3
return void

OffsetPursuit() public static method

Creates a force that tends to move towards an agent predicted position with an offset
public static OffsetPursuit ( Vector3 entityPosition, Vector3 entityVelocity, float entityMaxSpeed, float entityDeceleration, Vector3 leaderVelocity, float leaderMaxSpeed, Vector3 worldOffsetPosition, Vector3 forceInfluence, Vector3 &steeringForce ) : void
entityPosition Vector3 Current agent position
entityVelocity Vector3 Current agent velocity
entityMaxSpeed float Current agent maximum speed
entityDeceleration float Deceleration used when getting closer to target
leaderVelocity Vector3 Target velocity
leaderMaxSpeed float Target maximum speed
worldOffsetPosition Vector3 Offset position
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Pursuit() public static method

Creates a force that tends to move behind a given agent using prediction
public static Pursuit ( Vector3 pursuerPosition, Vector3 pursuerForward, Vector3 pursuerVelocity, float pursuerMaxSpeed, Vector3 evaderPosition, Vector3 evaderForward, Vector3 evaderVelocity, float evaderSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void
pursuerPosition Vector3 Current agent position
pursuerForward Vector3 Current agent forward vector
pursuerVelocity Vector3 Curret agent velocity
pursuerMaxSpeed float Current agent maximum speed
evaderPosition Vector3 Target agent position
evaderForward Vector3 Target agent forward vector
evaderVelocity Vector3 Target agent velocity
evaderSpeed float Target agent current speed
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Seek() public static method

Creates a force that tends to move towards a destination
public static Seek ( Vector3 position, Vector3 target, Vector3 velocity, float maxSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void
position Vector3 Current position of the agent
target Vector3 Current position of the destination
velocity Vector3 Current velocity of the agent
maxSpeed float Current maximum speed of the agent
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Separation() public static method

Creates a force that tends to move away from a list of other agents
public static Separation ( Vector3 entityPosition, List agentPositions, Vector3 forceInfluence, Vector3 &steeringForce ) : void
entityPosition Vector3 Current agent position
agentPositions List Considered agent positions
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void

Wander() public static method

Creates a force that randomly moves a given agent
public static Wander ( Random dice, Vector3 position, Vector3 velocity, Vector3 entityForward, Vector3 &wanderTarget, float wanderRadius, float wanderDistance, float wanderJitter, float maxSpeed, Vector3 forceInfluence, Vector3 &steeringForce ) : void
dice System.Random A Random instance
position Vector3 Current agent position
velocity Vector3 Current agent velocity
entityForward Vector3 Current agent forward vector
wanderTarget Vector3 Current wander position
wanderRadius float Radius of the circle used to compute wander positions
wanderDistance float Distance of the circle center used to compute wander positions
wanderJitter float Factor applied to the new wander position
maxSpeed float Current agent maximum speed
forceInfluence Vector3 Limits for each axis
steeringForce Vector3 The resulting force
return void