Infohazard.HyperNav 1.1.5
3D Navigation for Flying Characters
Loading...
Searching...
No Matches
Infohazard.HyperNav.AvoidanceManager Class Reference

Handles calculating the avoidance velocities for all IAvoidanceAgents. More...

Public Member Functions

virtual void UpdateAvoidance (float deltaTime)
 Update the avoidance of all agents. Can be called manually if UpdateMode is set to manual. More...
 

Protected Member Functions

virtual void OnEnable ()
 Schedule coroutine when the manager is enabled. More...
 
void OnDisable ()
 Dispose data structures when disabled. Coroutine will stop automatically. More...
 

Properties

AvoidanceManagerUpdateMode UpdateMode [get, set]
 When to update the avoidance velocities of agents. More...
 
float TimeHorizon [get, set]
 How far in the future to look when avoiding collisions. More...
 
int MaxObstaclesConsidered [get, set]
 The maximum number of obstacles that can be considered by each agent for avoidance. More...
 
float DataGrowRatio [get, set]
 How much to grow data structures by when they are not large enough. More...
 
bool UseJob [get, set]
 Whether to use the C# Job System/Burst Compiler or to just run updates on the main thread. More...
 

Private Attributes

AvoidanceManagerUpdateMode _updateMode
 (Serialized) When to update the avoidance velocities of agents. More...
 
float _timeHorizon = 5
 (Serialized) How far in the future to look when avoiding collisions. More...
 
int _maxObstaclesConsidered = 10
 (Serialized) The maximum number of obstacles that can be considered by each agent for avoidance. More...
 
float _dataGrowRatio = 1.2f
 (Serialized) How much to grow data structures by when they are not large enough. More...
 
bool _useJob = true
 (Serialized) Whether to use the C# Job System/Burst Compiler or to just run updates on the main thread. More...
 

Detailed Description

Handles calculating the avoidance velocities for all IAvoidanceAgents.

There should only be one AvoidanceManager active at a time, as it will handle all agents together. This is done using the C# Job System and Burst compiler to calculate avoidance very quickly. If it is still not fast enough, try changing the TimeHorizon and/or MaxObstaclesConsidered values.

Member Function Documentation

◆ OnDisable()

void Infohazard.HyperNav.AvoidanceManager.OnDisable ( )
protected

Dispose data structures when disabled. Coroutine will stop automatically.

◆ OnEnable()

virtual void Infohazard.HyperNav.AvoidanceManager.OnEnable ( )
protectedvirtual

Schedule coroutine when the manager is enabled.

◆ UpdateAvoidance()

virtual void Infohazard.HyperNav.AvoidanceManager.UpdateAvoidance ( float  deltaTime)
virtual

Update the avoidance of all agents. Can be called manually if UpdateMode is set to manual.

Parameters
deltaTimeTime delta since last call.

Member Data Documentation

◆ _dataGrowRatio

float Infohazard.HyperNav.AvoidanceManager._dataGrowRatio = 1.2f
private

(Serialized) How much to grow data structures by when they are not large enough.

Higher values reduce the number of allocations if agent count is steadily growing, but may also lead to wasted memory.

◆ _maxObstaclesConsidered

int Infohazard.HyperNav.AvoidanceManager._maxObstaclesConsidered = 10
private

(Serialized) The maximum number of obstacles that can be considered by each agent for avoidance.

This value caps the number of avoidance calculations per agent. Generally it should be equal to the max number of obstacles you expect to be within TimeHorizon * IAvoidanceObstacle.MaxSpeed of an agent.

◆ _timeHorizon

float Infohazard.HyperNav.AvoidanceManager._timeHorizon = 5
private

(Serialized) How far in the future to look when avoiding collisions.

A lower value reduces the number of calculations per agent, with the drawback of being able to plan less far ahead.

◆ _updateMode

AvoidanceManagerUpdateMode Infohazard.HyperNav.AvoidanceManager._updateMode
private

(Serialized) When to update the avoidance velocities of agents.

◆ _useJob

bool Infohazard.HyperNav.AvoidanceManager._useJob = true
private

(Serialized) Whether to use the C# Job System/Burst Compiler or to just run updates on the main thread.

Property Documentation

◆ DataGrowRatio

float Infohazard.HyperNav.AvoidanceManager.DataGrowRatio
getset

How much to grow data structures by when they are not large enough.

Higher values reduce the number of allocations if agent count is steadily growing, but may also lead to wasted memory.

◆ MaxObstaclesConsidered

int Infohazard.HyperNav.AvoidanceManager.MaxObstaclesConsidered
getset

The maximum number of obstacles that can be considered by each agent for avoidance.

This value caps the number of avoidance calculations per agent. Generally it should be equal to the max number of obstacles you expect to be within TimeHorizon * IAvoidanceObstacle.MaxSpeed of an agent.

◆ TimeHorizon

float Infohazard.HyperNav.AvoidanceManager.TimeHorizon
getset

How far in the future to look when avoiding collisions.

A lower value reduces the number of calculations per agent, with the drawback of being able to plan less far ahead.

◆ UpdateMode

AvoidanceManagerUpdateMode Infohazard.HyperNav.AvoidanceManager.UpdateMode
getset

When to update the avoidance velocities of agents.

◆ UseJob

bool Infohazard.HyperNav.AvoidanceManager.UseJob
getset

Whether to use the C# Job System/Burst Compiler or to just run updates on the main thread.


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