Class RVOController Extends VersionedMonoBehaviour

Public

RVO Character Controller.

Similar to Unity's CharacterController. It handles movement calculations and takes other agents into account. It does not handle movement itself, but allows the calling script to get the calculated velocity and use that to move the object using a method it sees fit (for example using a CharacterController, using transform.Translate or using a rigidbody).

Radius

Radius of the agent in world units.

Height

Height of the agent in world units.

Center

Center of the agent relative to the pivot point of this game object.

Agent Time Horizon

How far into the future to look for collisions with other agents (in seconds)

Obstacle Time Horizon

How far into the future to look for collisions with obstacles (in seconds)

Max Neighbours

Max number of other agents to take into account.

Layer

Specifies the avoidance layer for this agent.

Collides with

Layer mask specifying which layers this agent will avoid.

Priority

How strongly other agents will avoid this agent.

Lock When Not Moving

Automatically set locked to true when desired velocity is approximately zero.

Locked

A locked unit cannot move.

Debug

Enables drawing debug information in the scene view.

public void Update () {
// Just some point far away
var targetPoint = transform.position + transform.forward * 100;

// Set the desired point to move towards using a desired speed of 10 and a max speed of 12
controller.SetTarget(targetPoint, 10, 12, targetPoint);

// Calculate how much to move during this frame
// This information is based on movement commands from earlier frames
// as local avoidance is calculated globally at regular intervals by the RVOSimulator component
var delta = controller.CalculateMovementDelta(transform.position, Time.deltaTime);
transform.position = transform.position + delta;
}
For documentation of many of the variables of this class: refer to the Pathfinding.RVO.IAgent interface.

Note

Requires a single RVOSimulator component in the scene

A* Pro Feature

This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited.
The Pro version can be bought here

Public Methods

CalculateMovementDelta ([position], deltaTime)

Direction and distance to move in a single frame to avoid obstacles.

Move (velocity)

Set the desired velocity for the agent.

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

SetObstacleQuery (sourceNode)

Add obstacles to avoid for this agent.

SetTarget (pos, speed, maxSpeed, endOfPath)

Set the target point for the agent to move towards.

To2D (p, [elevation])

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

To3D (p, elevationCoordinate)

Converts a 2D vector in the movement plane as well as an elevation to a 3D coordinate.

Public Variables

AvoidingAnyAgents

True if the agent's movement is affected by any other agents or obstacles.

Public
agentTimeHorizon

How far into the future to look for collisions with other agents (in seconds)

Public
center

Center of the agent relative to the pivot point of this game object.

Public
collidesWith

Layer mask specifying which layers this agent will avoid.

Public
debug

Enables drawing debug information in the scene view.

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
lockWhenNotMoving

Automatically set locked to true when desired velocity is approximately zero.

Public
locked

A locked unit cannot move.

Public
maxNeighbours

Max number of other agents to take into account.

Public
movementPlane

Determines if the XY (2D) or XZ (3D) plane is used for movement.

Public
movementPlaneMode
Public
obstacleTimeHorizon

How far into the future to look for collisions with obstacles (in seconds)

Public
position

Current position of the agent.

Public
priority

How strongly other agents will avoid this agent.

Public
priorityMultiplier

Priority multiplier.

Public
radius

Radius of the agent in world units.

Public
rvoAgent

Reference to the internal agent.

Public
velocity

Current calculated velocity of the agent.

Public

Private/Protected Members

Awake ()
OnUpgradeSerializedData (migrations, unityThread)

RVOControllerMigrations
Private
Reset ()

Handle serialization backwards compatibility.

UpgradeSerializedData (isUnityThread)
ai

Cached reference to a movement script (if one is used)

Protected
aiBackingField
Private
centerBackingField
Private
heightBackingField
Private
movementPlaneBackingField
Internal
obstacleQuery
Private
radiusBackingField
Internal
simulator

Reference to the rvo simulator.

Private
tr

Cached tranform component.

Protected

Deprecated Members

wallAvoidFalloff

How much the wallAvoidForce decreases with distance.

Public
wallAvoidForce

An extra force to avoid walls.

Public