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).

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 (deltaTime)

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

Public
CalculateMovementDelta (position, deltaTime)

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

Public
DrawGizmos ()
Public
Move (velocity)

Set the desired velocity for the agent.

Public
SetCollisionNormal (normal)

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

Public
SetTarget (pos, speed, maxSpeed, endOfPath)

Set the target point for the agent to move towards.

Public
To2D (p)

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

Public
To2D (p, elevation)

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

Public
To3D (p, elevationCoordinate)

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

Public

Public Variables

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 ()
Protected
OnAgentDestroyed ()
Private
OnDisable ()
Private
OnEnable ()
Private
OnUpgradeSerializedData (migrations, unityThread)

Handle serialization backwards compatibility.

Protected
OnUpgradeSerializedData (migrations, unityThread)
Protected
RVOControllerMigrations
Private
Reset ()

Handle serialization backwards compatibility.

Protected
UpdateAgentProperties ()
Protected
UpgradeSerializedData (isUnityThread)
Protected
ai

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

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

Reference to the rvo simulator.

Private
tr

Cached tranform component.

Protected

Deprecated Members

ForceSetVelocity (velocity)

Set the current velocity of the agent.

Public
Teleport (pos)

Teleport the agent to a new position.

Public
enableRotation
Public
mask
Public
maxSpeed
Public
rotationSpeed
Public
wallAvoidFalloff

How much the wallAvoidForce decreases with distance.

Public
wallAvoidForce

An extra force to avoid walls.

Public