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

// 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
Move (vel)

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)

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
height

Height of the agent in world units.

Public
layer

Specifies the avoidance layer for this agent.

Public
locked

A locked unit cannot move.

Public
lockWhenNotMoving

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

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
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
radius

Radius of the agent in world units.

Public
rvoAgent

Reference to the internal agent.

Public
simulator

Reference to the rvo simulator.

Public
velocity

Current calculated velocity of the agent.

Public

Private/Protected Members

ai

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

Protected
aiBackingField
Private
Awake ()
Protected
centerBackingField
Private
heightBackingField
Private
OnDisable ()
Private
OnDrawGizmos ()
Private
OnEnable ()
Private
OnUpgradeSerializedData (version, unityThread)

Handle serialization backwards compatibility.

Protected
radiusBackingField
Package
Reset ()

Handle serialization backwards compatibility.

Protected
tr

Cached tranform component.

Protected
UpdateAgentProperties ()
Protected

Deprecated Members

enableRotation
Public
ForceSetVelocity (velocity)
Public
mask
Public
maxSpeed
Public
rotationSpeed
Public
Teleport (pos)

Teleport the agent to a new position.

Public
wallAvoidFalloff

How much the wallAvoidForce decreases with distance.

Public
wallAvoidForce

An extra force to avoid walls.

Public