Class RVOController Extends VersionedMonoBehaviour
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 of the agent in world units.
Height of the agent in world units.
Center of the agent relative to the pivot point of this game object.
How far into the future to look for collisions with other agents (in seconds)
How far into the future to look for collisions with obstacles (in seconds)
Max number of other agents to take into account.
Specifies the avoidance layer for this agent.
Layer mask specifying which layers this agent will avoid.
How strongly other agents will avoid this agent.
Automatically set locked to true when desired velocity is approximately zero.
A locked unit cannot move.
Enables drawing debug information in the scene view.
public void Update () {
For documentation of many of the variables of this class: refer to the Pathfinding.RVO.IAgent interface.
// 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;
}
Requires a single RVOSimulator component in the scene
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
Direction and distance to move in a single frame to avoid obstacles.
Set the normal of a wall (or something else) the agent is currently colliding with.
Converts a 2D vector in the movement plane as well as an elevation to a 3D coordinate.
Public Variables
True if the agent's movement is affected by any other agents or obstacles.
How far into the future to look for collisions with other agents (in seconds)
Center of the agent relative to the pivot point of this game object.
Layer mask specifying which layers this agent will avoid.
Enables drawing debug information in the scene view.
Determines how strongly this agent just follows the flow instead of making other agents avoid it.
Height of the agent in world units.
Specifies the avoidance layer for this agent.
Automatically set locked to true when desired velocity is approximately zero.
A locked unit cannot move.
Max number of other agents to take into account.
Determines if the XY (2D) or XZ (3D) plane is used for movement.
How far into the future to look for collisions with obstacles (in seconds)
Current position of the agent.
How strongly other agents will avoid this agent.
Priority multiplier.
Radius of the agent in world units.
Reference to the internal agent.
Current calculated velocity of the agent.
Private/Protected Members
Cached reference to a movement script (if one is used)
Reference to the rvo simulator.
Cached tranform component.
Deprecated Members
How much the wallAvoidForce decreases with distance.
An extra force to avoid walls.