A* Pathfinding Project  4.3.2
The A* Pathfinding Project for Unity 3D
RVOSimulator Class Reference

Unity front end for an RVO simulator. More...

Detailed Description

Unity front end for an RVO simulator.

Attached to any GameObject in a scene, scripts such as the RVOController will use the simulator exposed by this class to handle their movement. In pretty much all cases you should only have a single RVOSimulator in the scene.

You can have more than one of these, however most scripts which make use of the RVOSimulator will use the active property which just returns the first simulator in the scene.

This is only a wrapper class for a Pathfinding.RVO.Simulator which simplifies exposing it for a unity scene.

See also
Local Avoidance

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 Member Functions

ISimulator GetSimulator ()
 Get the internal simulator. More...

Public Attributes

bool burst
int desiredSimulationFPS = 20
 Desired FPS for rvo simulation. More...
bool doubleBuffering
 Calculate local avoidance in between frames. More...
bool drawObstacles
 Draw obstacle gizmos to aid with debugging. More...
bool hardCollisions = true
 Prevent agent overlap more aggressively. More...
MovementPlane movementPlane = MovementPlane.XZ
 Determines if the XY (2D) or XZ (3D) plane is used for movement. More...
float symmetryBreakingBias = 0.1f
 Bias agents to pass each other on the right side. More...
ThreadCount workerThreads = ThreadCount.Two
 Number of RVO worker threads. More...


static RVOSimulator active [get, private set]
 First RVOSimulator in the scene (usually there is only one) More...
- Properties inherited from VersionedMonoBehaviour
int Util.IEntityIndex. EntityIndex [get, set]
 Internal entity index used by #BurstBatchHelper. More...
- Properties inherited from IEntityIndex
int EntityIndex [get, set]

Private Member Functions

void OnDestroy ()
void OnEnable ()
void Update ()
 Update the simulation. More...

Private Attributes

Pathfinding.RVO.Simulator simulator
 Reference to the internal simulator. More...
Pathfinding.RVO.SimulatorBurst simulatorBurst
 Reference to the internal simulator. More...

Additional Inherited Members

- Protected Member Functions inherited from VersionedMonoBehaviour
virtual void Awake ()
virtual int OnUpgradeSerializedData (int version, bool unityThread)
 Handle serialization backwards compatibility. More...
virtual void Reset ()
 Handle serialization backwards compatibility. More...

Member Function Documentation

◆ GetSimulator()

ISimulator GetSimulator ( )

Get the internal simulator.

Will never be null when the game is running

◆ OnDestroy()

void OnDestroy ( )

◆ OnEnable()

void OnEnable ( )

◆ Update()

void Update ( )

Update the simulation.

Member Data Documentation

◆ burst

bool burst

◆ desiredSimulationFPS

int desiredSimulationFPS = 20

Desired FPS for rvo simulation.

It is usually not necessary to run a crowd simulation at a very high fps. Usually 10-30 fps is enough, but it can be increased for better quality. The rvo simulation will never run at a higher fps than the game

◆ doubleBuffering

bool doubleBuffering

Calculate local avoidance in between frames.

If this is enabled and multithreading is used, the local avoidance calculations will continue to run until the next frame instead of waiting for them to be done the same frame. This can increase the performance but it can make the agents seem a little less responsive.

This will only be read at Awake.

See also

◆ drawObstacles

bool drawObstacles

Draw obstacle gizmos to aid with debugging.

In the screenshot the obstacles are visible in red.

◆ hardCollisions

bool hardCollisions = true

Prevent agent overlap more aggressively.

This will it much harder for agents to overlap, even in crowded scenarios. It is particularly noticable when running at a low simulation fps. This does not influence agent avoidance when the agents are not overlapping.

Enabling this has a small performance penalty, usually not high enough to care about.

Disabling this may be beneficial if you want softer behaviour when larger groups of agents collide.

◆ movementPlane

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

For 2D games you would set this to XY and for 3D games you would usually set it to XZ.

◆ simulator

Pathfinding.RVO.Simulator simulator

Reference to the internal simulator.

◆ simulatorBurst

Pathfinding.RVO.SimulatorBurst simulatorBurst

Reference to the internal simulator.

◆ symmetryBreakingBias

float symmetryBreakingBias = 0.1f

Bias agents to pass each other on the right side.

If the desired velocity of an agent puts it on a collision course with another agent or an obstacle its desired velocity will be rotated this number of radians (1 radian is approximately 57°) to the right. This helps to break up symmetries and makes it possible to resolve some situations much faster.

When many agents have the same goal this can however have the side effect that the group clustered around the target point may as a whole start to spin around the target point.

Recommended values are in the range of 0 to 0.2.

If this value is negative, the agents will be biased towards passing each other on the left side instead.

◆ workerThreads

ThreadCount workerThreads = ThreadCount.Two

Number of RVO worker threads.

If set to None, no multithreading will be used. Using multithreading can significantly improve performance by offloading work to other CPU cores.

Property Documentation

◆ active

RVOSimulator active
staticgetprivate set

First RVOSimulator in the scene (usually there is only one)

The documentation for this class was generated from the following file: