A* Pathfinding Project  4.0.7
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
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 script which make use of the RVOSimulator will find it by FindObjectOfType, and thus only one will be used.

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

Simulator GetSimulator ()
 Get the internal simulator.

Public Attributes

int desiredSimulationFPS = 20
 Desired FPS for rvo simulation.
bool doubleBuffering
 Calculate local avoidance in between frames.
MovementPlane movementPlane = MovementPlane.XZ
 Determines if the XY (2D) or XZ (3D) plane is used for movement.
float symmetryBreakingBias = 0.1f
 Bias agents to pass each other on the right side.
ThreadCount workerThreads = ThreadCount.Two
 Number of RVO worker threads.

Protected Member Functions

override void Awake ()
- Protected Member Functions inherited from VersionedMonoBehaviour
virtual int OnUpgradeSerializedData (int version)
 Handle serialization backwards compatibility.


static RVOSimulator active [get, set]
 First RVOSimulator in the scene (usually there is only one)

Private Member Functions

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

Private Attributes

Pathfinding.RVO.Simulator simulator
 Reference to the internal simulator.

Member Function Documentation

override void Awake ( )

Reimplemented from VersionedMonoBehaviour.

Simulator GetSimulator ( )

Get the internal simulator.

Will never be null when the game is running

void OnDestroy ( )
void OnEnable ( )
void Update ( )

Update the simulation.

Member Data Documentation

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

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
MovementPlane movementPlane = MovementPlane.XZ

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.

Pathfinding.RVO.Simulator simulator

Reference to the internal simulator.

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.

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

RVOSimulator active

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

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