Public
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.
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
Get the internal simulator.
Will never be null when the game is running
Public Variables
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
Pathfinding.RVO.Simulator.DoubleBuffering
bool
drawObstacles
Draw obstacle gizmos to aid with debugging.
In the screenshot the obstacles are visible in red.
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
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.
float
symmetryBreakingBias = 0.1f
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.
Public Static Variables
Private/Protected Members
int
OnUpgradeSerializedData
(
int | version | |
bool | unityThread | |
)
Handle serialization backwards compatibility.
void
Reset
()
Handle serialization backwards compatibility.
void
Update
()
Update the simulation.
Reference to the internal simulator.