Class Agent Extends IAgent

Public

Internal agent for the RVO system.

Usually you will interface with the IAgent interface instead.

See

IAgent

Inner Types

VO

Velocity Obstacle.

Very simple list.

Public Methods

Agent (pos, elevationCoordinate)
Public
BufferSwitch ()

Reads public properties and stores them in internal fields.

Public
CalculateNeighbours ()

Populate the neighbours and neighbourDists lists with the closest agents to this agent.

Public
ForceSetVelocity (velocity)

Set the current velocity of the agent.

Public
PostCalculation ()
Public
PreCalculation ()
Public
SetCollisionNormal (normal)

Set the normal of a wall (or something else) the agent is currently colliding with.

Public
SetTarget (targetPoint, desiredSpeed, maxSpeed)

Point towards which the agent should move.

Public

Public Variables

AgentIndex
Public
AgentTimeHorizon

Max number of estimated seconds to look into the future for collisions with agents.

Public
CalculatedSpeed

Optimal speed of the agent to avoid collisions.

Public
CalculatedTargetPoint

Optimal point to move towards to avoid collisions.

Public
CollidesWith

Layer mask specifying which layers this agent will avoid.

Public
DebugDraw

Draw debug information.

Public
ElevationCoordinate

Coordinate which separates characters in the height direction.

Public
FlowFollowingStrength

Determines how strongly this agent just follows the flow instead of making other agents avoid it.

Public
Height

Height of the agent in world units.

Public
Layer

Specifies the avoidance layer for this agent.

Public
Locked

Locked agents will be assumed not to move.

Public
MaxNeighbours

Max number of agents to take into account.

Public
NeighbourCount

Number of neighbours that the agent took into account during the last simulation step.

Public
NeighbourObstacles
Public
ObstacleTimeHorizon

Max number of estimated seconds to look into the future for collisions with obstacles.

Public
Position

Position of the agent.

Public
PreCalculationCallback

Callback which will be called right before avoidance calculations are started.

Public
Priority

How strongly other agents will avoid this agent.

Public
Radius

Radius of the agent in world units.

Public

Private/Protected Members

agentTimeHorizon
Private
BiasDesiredVelocity (vos, desiredVelocity, targetPointInVelocitySpace, maxBiasRadians)

Bias towards the right side of agents.

Private Static
calculatedSpeed
Private
calculatedTargetPoint
Private
CalculateHardCollisions ()
Package
CalculateHorizonAvoidancePhase1 (context)

Inspired by StarCraft 2's avoidance of locked units.

Package
CalculateHorizonAvoidancePhase2 (context)
Package
CalculateVelocity (context)
Package
collidesWith
Private
collisionNormal
Private
collisionStrength
Private
currentVelocity
Private
debugDraw
Private
desiredSpeed
Private
desiredTargetPointInVelocitySpace

Desired target point - position.

Private
desiredVelocity
Private
DesiredVelocityWeight
Private
DrawVO (circleCenter, radius, origin)
Private Static
elevationCoordinate
Private
EvaluateGradient (vos, p, value)

Evaluate gradient and value of the cost function at velocity p.

Private
floatComparer

Required to avoid allocations on Mono.

Private Static Readonly
FromXZ (p)

(x, 0, y)

Private Static
GenerateNeighbourAgentVOs (vos)
Private
GenerateObstacleVOs (vos)
Private
GradientDescent (vos, sampleAround1, sampleAround2)
Private
height
Private
horizonBias
Private
horizonMaxAngle
Private
horizonMinAngle
Private
horizonSide
Private
InAngleRange (a, b, x)
Private
InsertAgentNeighbour (agent, rangeSq)

Used by the Quadtree.

Package
layer
Private
locked
Package
manuallyControlled
Private
maxNeighbours
Private
maxSpeed
Private
neighbourDists
Private
neighbours
Private
next

Used internally for a linked list.

Package
nextDesiredSpeed
Private
nextMaxSpeed
Private
nextTargetPoint
Private
obstacles
Private
obstaclesBuffered
Private
obstacleTimeHorizon
Private
offsetVelocity
Private
position
Package
radius
Package
Rainbow (v)
Private Static
simulator

Simulator which handles this agent.

Package
Sqr (x)

Square a number.

Private Static
To2D (p, elevation)

Converts a 3D vector to a 2D vector in the movement plane.

Private
ToXZ (p)

(x, z)

Private Static
Trace (vos, p, score)

Traces the vector field constructed out of the velocity obstacles.

Private
WallWeight

Extra weight that walls will have.

Private