A* Pathfinding Project
4.3.2
The A* Pathfinding Project for Unity 3D
|
Unity front end for an RVO simulator. More...
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.
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... | |
Properties | |
static RVOSimulator | active [get, private set] |
First RVOSimulator in the scene (usually there is only one) More... | |
![]() | |
int Util.IEntityIndex. | EntityIndex [get, set] |
Internal entity index used by #BurstBatchHelper. More... | |
![]() | |
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 | |
![]() | |
virtual void | Awake () |
virtual int | OnUpgradeSerializedData (int version, bool unityThread) |
Handle serialization backwards compatibility. More... | |
virtual void | Reset () |
Handle serialization backwards compatibility. More... | |
ISimulator GetSimulator | ( | ) |
Get the internal simulator.
Will never be null when the game is running
|
private |
|
private |
|
private |
Update the simulation.
bool burst |
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.
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.
|
private |
Reference to the internal simulator.
|
private |
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.
|
staticgetprivate set |
First RVOSimulator in the scene (usually there is only one)