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

Base implementation of IAvoidanceAgent that should work in most scenarios. More...

Public Member Functions

void UpdateAvoidanceVelocity (Vector3 newAvoidance)
 Called by the system to update AvoidanceVelocity.
Parameters
newAvoidanceNew avoidance velocity
More...
 
void UpdateAvoidanceVelocity (Vector3 newAvoidance)
 Called by the system to update AvoidanceVelocity. More...
 

Protected Member Functions

override void OnEnable ()
 Resets desired velocity and adds self to list of all obstacles. More...
 
override void OnDisable ()
 Removes self from list of all obstacles. More...
 
virtual void OnEnable ()
 Resets desired velocity and adds self to list of all obstacles. More...
 
virtual void OnDisable ()
 Removes self from list of all obstacles. More...
 

Properties

virtual float AvoidanceWeight [get, set]
 How much effort the agent will take to avoid obstacles and other agents. More...
 
virtual float AvoidancePadding [get, set]
 How much extra space to leave when avoiding obstacles. More...
 
virtual bool DebugAvoidance [get, set]
 Whether to draw debugging information in the scene view. More...
 
TagMask AvoidedTags [get, set]
 Tags of objects that the agent will try to avoid. More...
 
Func< Vector3 > InputVelocityFunc [get, set]
 Function used to calculate InputVelocity. More...
 
override Vector3 InputVelocity [get]
 The object's desired (or actual) velocity. More...
 
virtual bool IsActive [get, set]
 Whether the agent should actively avoid obstacles. If false, will still behave as an obstacle. More...
 
virtual Vector3 AvoidanceVelocity [get]
 The velocity the agent should have in order to avoid collisions with obstacles and other agents. More...
 
virtual Vector3 NormalizedAvoidanceVelocity [get]
 Avoidance velocity divided by max speed, so it is in [0, 1] range. More...
 
- Properties inherited from Infohazard.HyperNav.AvoidanceObstacleBase
virtual float MaxSpeed [get, set]
 Maximum speed the object can travel at. More...
 
virtual float Radius [get, set]
 Radius of the object from its position. More...
 
virtual Vector3 Position [get]
 World-space position of the object. More...
 
virtual Vector3 InputVelocity [get]
 The object's desired (or actual) velocity. More...
 
TagMask TagMask [get, private set]
 Tag of the object for matching agents' IAvoidanceAgent.AvoidedTags. More...
 
- Properties inherited from Infohazard.HyperNav.IAvoidanceObstacle
Vector3 Position [get]
 World-space position of the object. More...
 
Vector3 InputVelocity [get]
 The object's desired (or actual) velocity. More...
 
float MaxSpeed [get]
 Maximum speed the object can travel at. More...
 
float Radius [get]
 Radius of the object from its position. More...
 
TagMask TagMask [get]
 Tag of the object for matching agents' IAvoidanceAgent.AvoidedTags. More...
 
- Properties inherited from Infohazard.HyperNav.IAvoidanceAgent
float AvoidanceWeight [get]
 How much effort the agent will take to avoid obstacles and other agents. More...
 
float AvoidancePadding [get]
 How much extra space to leave when avoiding obstacles. More...
 
Vector3 AvoidanceVelocity [get]
 The velocity the agent should have in order to avoid collisions with obstacles and other agents. More...
 
bool IsActive [get]
 Whether the agent should actively avoid obstacles. If false, will still behave as an obstacle. More...
 
bool DebugAvoidance [get]
 Whether to draw debugging information in the scene view. More...
 
TagMask AvoidedTags [get]
 Tags of objects that the agent will try to avoid. More...
 

Events

Action< Vector3 > AvoidanceUpdated
 Invoked when avoidance is updated. More...
 

Private Attributes

float _avoidanceWeight = 1
 (Serialized) How much effort the agent will take to avoid obstacles and other agents. More...
 
float _avoidancePadding = 0.1f
 (Serialized) How much extra space to leave when avoiding obstacles. More...
 
bool _debugAvoidance = false
 (Serialized) Whether to draw debugging information in the scene view. More...
 
TagMask _avoidedTags = ~0
 (Serialized) Tags of objects that the agent will try to avoid. More...
 

Detailed Description

Base implementation of IAvoidanceAgent that should work in most scenarios.

It gets its desired velocity from a delegate, so you can point it to whatever system you need.

Member Function Documentation

◆ OnDisable()

override void Infohazard.HyperNav.AvoidanceAgent.OnDisable ( )
protectedvirtual

Removes self from list of all obstacles.

Reimplemented from Infohazard.HyperNav.AvoidanceObstacleBase.

◆ OnEnable()

override void Infohazard.HyperNav.AvoidanceAgent.OnEnable ( )
protectedvirtual

Resets desired velocity and adds self to list of all obstacles.

Reimplemented from Infohazard.HyperNav.AvoidanceObstacleBase.

◆ UpdateAvoidanceVelocity()

void Infohazard.HyperNav.AvoidanceAgent.UpdateAvoidanceVelocity ( Vector3  newAvoidance)

Called by the system to update AvoidanceVelocity.

Parameters
newAvoidanceNew avoidance velocity

Implements Infohazard.HyperNav.IAvoidanceAgent.

Member Data Documentation

◆ _avoidancePadding

float Infohazard.HyperNav.AvoidanceAgent._avoidancePadding = 0.1f
private

(Serialized) How much extra space to leave when avoiding obstacles.

◆ _avoidanceWeight

float Infohazard.HyperNav.AvoidanceAgent._avoidanceWeight = 1
private

(Serialized) How much effort the agent will take to avoid obstacles and other agents.

◆ _avoidedTags

TagMask Infohazard.HyperNav.AvoidanceAgent._avoidedTags = ~0
private

(Serialized) Tags of objects that the agent will try to avoid.

◆ _debugAvoidance

bool Infohazard.HyperNav.AvoidanceAgent._debugAvoidance = false
private

(Serialized) Whether to draw debugging information in the scene view.

Property Documentation

◆ AvoidancePadding

virtual float Infohazard.HyperNav.AvoidanceAgent.AvoidancePadding
getsetadd

How much extra space to leave when avoiding obstacles.

Implements Infohazard.HyperNav.IAvoidanceAgent.

◆ AvoidanceVelocity

virtual Vector3 Infohazard.HyperNav.AvoidanceAgent.AvoidanceVelocity
get

The velocity the agent should have in order to avoid collisions with obstacles and other agents.

Implements Infohazard.HyperNav.IAvoidanceAgent.

◆ AvoidanceWeight

virtual float Infohazard.HyperNav.AvoidanceAgent.AvoidanceWeight
getset

How much effort the agent will take to avoid obstacles and other agents.

Implements Infohazard.HyperNav.IAvoidanceAgent.

◆ AvoidedTags

TagMask Infohazard.HyperNav.AvoidanceAgent.AvoidedTags
getset

Tags of objects that the agent will try to avoid.

Implements Infohazard.HyperNav.IAvoidanceAgent.

◆ DebugAvoidance

virtual bool Infohazard.HyperNav.AvoidanceAgent.DebugAvoidance
getset

Whether to draw debugging information in the scene view.

Implements Infohazard.HyperNav.IAvoidanceAgent.

◆ InputVelocity

override Vector3 Infohazard.HyperNav.AvoidanceAgent.InputVelocity
get

The object's desired (or actual) velocity.

Implements Infohazard.HyperNav.IAvoidanceObstacle.

◆ InputVelocityFunc

Func<Vector3> Infohazard.HyperNav.AvoidanceAgent.InputVelocityFunc
getset

Function used to calculate InputVelocity.

◆ IsActive

virtual bool Infohazard.HyperNav.AvoidanceAgent.IsActive
getset

Whether the agent should actively avoid obstacles. If false, will still behave as an obstacle.

Implements Infohazard.HyperNav.IAvoidanceAgent.

◆ NormalizedAvoidanceVelocity

virtual Vector3 Infohazard.HyperNav.AvoidanceAgent.NormalizedAvoidanceVelocity
get

Avoidance velocity divided by max speed, so it is in [0, 1] range.

Event Documentation

◆ AvoidanceUpdated

Action<Vector3> Infohazard.HyperNav.AvoidanceAgent.AvoidanceUpdated

Invoked when avoidance is updated.


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