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

A volume of space in which HyperNav pathfinding can occur. More...

Classes

class  PropNames
 This is used to refer to the names of private fields in this class from a custom Editor. More...
 

Public Member Functions

virtual bool SamplePosition (Vector3 position, out NavHit hit, float maxDistance)
 Perform a query to find the nearest point on this volume to the given point. More...
 
bool Raycast (Vector3 start, Vector3 end, out float hit)
 Cast a ray against the blocking triangles of the volume, and return the nearest hit. More...
 
void UpdateTransform ()
 Update the native data of this NavVolume. More...
 

Static Public Member Functions

static void UpdateAllTransforms ()
 Update the native data on all loaded NavVolumes. More...
 

Static Public Attributes

static NativeParallelHashMap< long, NativeNavVolumeDataVolumeData
 Data for all loaded volumes in the format used by jobs. More...
 

Protected Member Functions

virtual void OnEnable ()
 Register this volume in the Volumes dictionary and perform initialization. More...
 
virtual void OnDisable ()
 Remove this volume from the Volumes dictionary. More...
 
virtual void OnDestroy ()
 Dispose native-side data for this volume. More...
 
virtual void Update ()
 Update UniqueID in editor, and check movement. More...
 

Properties

Bounds Bounds [get, set]
 The boundaries of the volume. More...
 
NavVolumeData Data [get, set]
 The baked data for the volume. More...
 
long InstanceID [get]
 The unique ID for this volume to identify it in pathfinding jobs and serialized data. More...
 
bool AutoDetectMovement [get, set]
 Whether to automatically update native data if the volume moves. More...
 
float VoxelSize [get, set]
 The voxel size of this volume, which determines the precision but also baking cost. More...
 
float MaxAgentRadius [get, set]
 The maximum size of agents using this volume. More...
 
bool EnableMultiQuery [get, set]
 Whether to enable multiple physics queries per voxel to get a more accurate result. More...
 
float MaxExternalLinkDistance [get, set]
 The maximum distance that external links can extend outside of this volume. More...
 
LayerMask BlockingLayers [get, set]
 Which layers are considered impassible for pathfinding. More...
 
bool StaticOnly [get, set]
 Whether only static objects should be included in the baked data. More...
 
bool UseStartLocations [get, set]
 Whether only regions connected to certain locations are considered valid. More...
 
IReadOnlyList< Vector3 > StartLocations [get, set]
 If _useStartLocations is true, which start locations to use. More...
 
bool UseMultithreading [get, set]
 Whether to use multiple threads when baking the volume. More...
 
NavVolumeVisualizationMode VisualizationMode [get, set]
 Stage at which to visualize the volume bake process in the scene view. More...
 
bool VisualizeNeighbors [get, set]
 Whether to show the connections of a selected region in the scene view. More...
 
int VisualizeNeighborsRegion [get, set]
 If _visualizeNeighbors is true, which region to visualize in the scene view. More...
 
bool ShowVertexNumbers [get, set]
 Whether to show the vertex numbers of the preview mesh in the scene view (for debugging). More...
 
float ShowVertexNumbersRange [get, set]
 Max distance from the camera at which vertex numbers will be shown. More...
 
bool VisualizeVoxelQueries [get, set]
 Whether to visualize the queries that are performed for a voxel when baking. More...
 
static int VolumeChangingCount [get, private set]
 Number of places that are modifying volume data. More...
 
static IReadOnlyDictionary< long, NavVolumeVolumes [get]
 All currently loaded volumes. More...
 

Events

static Action VolumeDataChanging
 Event that is invoked immediately before active volume data changes. More...
 
static Action VolumeDataChanged
 Event that is invoked immediately after active volume data changes. More...
 

Private Attributes

Bounds _bounds = new Bounds(Vector3.zero, Vector3.one)
 (Serialized) The boundaries of the volume. More...
 
NavVolumeData _data
 (Serialized) The baked data for the volume. More...
 
long _instanceID
 (Serialized) The unique ID for this volume to identify it in pathfinding jobs and serialized data. More...
 
bool _autoDetectMovement = false
 (Serialized) Whether to automatically update native data if the volume moves. More...
 
LayerMask _blockingLayers = 1
 (Serialized) Which layers are considered impassible for pathfinding. More...
 
bool _staticOnly = true
 (Serialized) Whether only static objects should be included in the baked data. More...
 
float _maxAgentRadius = 1
 (Serialized) The maximum size of agents using this volume. More...
 
bool _enableMultiQuery = true
 (Serialized) Whether to enable multiple physics queries per voxel to get a more accurate result. More...
 
float _maxExternalLinkDistance = 1
 (Serialized) The maximum distance that external links can extend outside of this volume. More...
 
float _voxelSize = 1
 (Serialized) The voxel size of this volume, which determines the precision but also baking cost. More...
 
bool _useStartLocations = false
 (Serialized) Whether only regions connected to certain locations are considered valid. More...
 
Vector3[] _startLocations
 (Serialized) If _useStartLocations is true, which start locations to use. More...
 
bool _useMultithreading = true
 (Serialized) Whether to use multiple threads when baking the volume. More...
 
NavVolumeVisualizationMode _visualizationMode = NavVolumeVisualizationMode.Final
 (Serialized) Stage at which to visualize the volume bake process in the scene view. More...
 
bool _visualizeNeighbors
 (Serialized) Whether to show the connections of a selected region in the scene view. More...
 
int _visualizeNeighborsRegion
 (Serialized) If _visualizeNeighbors is true, which region to visualize in the scene view. More...
 
bool _showVertexNumbers
 (Serialized) Whether to show the vertex numbers of the preview mesh in the scene view (for debugging). More...
 
float _showVertexNumbersRange = 2
 (Serialized) Max distance from the camera at which vertex numbers will be shown. More...
 
bool _visualizeVoxelQueries
 (Serialized) Whether to visualize the queries that are performed for a voxel when baking. More...
 

Detailed Description

A volume of space in which HyperNav pathfinding can occur.

Each NavVolume is divided into convex regions that form pathfinding nodes. A volume's regions can have connections to each other, and to regions of other volumes. The information in a NavVolume must be baked in the editor - it cannot be calculated at runtime (for now).

Member Function Documentation

◆ OnDestroy()

virtual void Infohazard.HyperNav.NavVolume.OnDestroy ( )
protectedvirtual

Dispose native-side data for this volume.

◆ OnDisable()

virtual void Infohazard.HyperNav.NavVolume.OnDisable ( )
protectedvirtual

Remove this volume from the Volumes dictionary.

◆ OnEnable()

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

Register this volume in the Volumes dictionary and perform initialization.

◆ Raycast()

bool Infohazard.HyperNav.NavVolume.Raycast ( Vector3  start,
Vector3  end,
out float  hit 
)

Cast a ray against the blocking triangles of the volume, and return the nearest hit.

Parameters
startThe position (in world space) to start the query at.
endThe position (in world space) to end the query at.
hitIf the query hits a triangle, the ratio between start and end at which the hit occurred.
Returns
Whether a triangle was hit.

◆ SamplePosition()

virtual bool Infohazard.HyperNav.NavVolume.SamplePosition ( Vector3  position,
out NavHit  hit,
float  maxDistance 
)
virtual

Perform a query to find the nearest point on this volume to the given point.

Parameters
positionThe point at which to search.
hitThe resulting hit, containing the nearest point on this volume.
maxDistanceThe radius in which to search (a larger value is more expensive).
Returns
Whether a hit on this volume could be found in the given radius.

◆ Update()

virtual void Infohazard.HyperNav.NavVolume.Update ( )
protectedvirtual

Update UniqueID in editor, and check movement.

◆ UpdateAllTransforms()

static void Infohazard.HyperNav.NavVolume.UpdateAllTransforms ( )
static

Update the native data on all loaded NavVolumes.

Use this after moving all volumes when AutoDetectMovement is disabled.

◆ UpdateTransform()

void Infohazard.HyperNav.NavVolume.UpdateTransform ( )

Update the native data of this NavVolume.

This is called automatically if AutoDetectMovement is enabled.

Member Data Documentation

◆ _autoDetectMovement

bool Infohazard.HyperNav.NavVolume._autoDetectMovement = false
private

(Serialized) Whether to automatically update native data if the volume moves.

◆ _blockingLayers

LayerMask Infohazard.HyperNav.NavVolume._blockingLayers = 1
private

(Serialized) Which layers are considered impassible for pathfinding.

◆ _bounds

Bounds Infohazard.HyperNav.NavVolume._bounds = new Bounds(Vector3.zero, Vector3.one)
private

(Serialized) The boundaries of the volume.

◆ _data

NavVolumeData Infohazard.HyperNav.NavVolume._data
private

(Serialized) The baked data for the volume.

◆ _enableMultiQuery

bool Infohazard.HyperNav.NavVolume._enableMultiQuery = true
private

(Serialized) Whether to enable multiple physics queries per voxel to get a more accurate result.

◆ _instanceID

long Infohazard.HyperNav.NavVolume._instanceID
private

(Serialized) The unique ID for this volume to identify it in pathfinding jobs and serialized data.

◆ _maxAgentRadius

float Infohazard.HyperNav.NavVolume._maxAgentRadius = 1
private

(Serialized) The maximum size of agents using this volume.

◆ _maxExternalLinkDistance

float Infohazard.HyperNav.NavVolume._maxExternalLinkDistance = 1
private

(Serialized) The maximum distance that external links can extend outside of this volume.

◆ _showVertexNumbers

bool Infohazard.HyperNav.NavVolume._showVertexNumbers
private

(Serialized) Whether to show the vertex numbers of the preview mesh in the scene view (for debugging).

◆ _showVertexNumbersRange

float Infohazard.HyperNav.NavVolume._showVertexNumbersRange = 2
private

(Serialized) Max distance from the camera at which vertex numbers will be shown.

◆ _startLocations

Vector3 [] Infohazard.HyperNav.NavVolume._startLocations
private

(Serialized) If _useStartLocations is true, which start locations to use.

◆ _staticOnly

bool Infohazard.HyperNav.NavVolume._staticOnly = true
private

(Serialized) Whether only static objects should be included in the baked data.

◆ _useMultithreading

bool Infohazard.HyperNav.NavVolume._useMultithreading = true
private

(Serialized) Whether to use multiple threads when baking the volume.

◆ _useStartLocations

bool Infohazard.HyperNav.NavVolume._useStartLocations = false
private

(Serialized) Whether only regions connected to certain locations are considered valid.

◆ _visualizationMode

NavVolumeVisualizationMode Infohazard.HyperNav.NavVolume._visualizationMode = NavVolumeVisualizationMode.Final
private

(Serialized) Stage at which to visualize the volume bake process in the scene view.

◆ _visualizeNeighbors

bool Infohazard.HyperNav.NavVolume._visualizeNeighbors
private

(Serialized) Whether to show the connections of a selected region in the scene view.

◆ _visualizeNeighborsRegion

int Infohazard.HyperNav.NavVolume._visualizeNeighborsRegion
private

(Serialized) If _visualizeNeighbors is true, which region to visualize in the scene view.

◆ _visualizeVoxelQueries

bool Infohazard.HyperNav.NavVolume._visualizeVoxelQueries
private

(Serialized) Whether to visualize the queries that are performed for a voxel when baking.

◆ _voxelSize

float Infohazard.HyperNav.NavVolume._voxelSize = 1
private

(Serialized) The voxel size of this volume, which determines the precision but also baking cost.

◆ VolumeData

NativeParallelHashMap<long, NativeNavVolumeData> Infohazard.HyperNav.NavVolume.VolumeData
static

Data for all loaded volumes in the format used by jobs.

Property Documentation

◆ AutoDetectMovement

bool Infohazard.HyperNav.NavVolume.AutoDetectMovement
getset

Whether to automatically update native data if the volume moves.

Note that if this is true and the volume moves every frame, pathfinding will never be able to occur.

◆ BlockingLayers

LayerMask Infohazard.HyperNav.NavVolume.BlockingLayers
getset

Which layers are considered impassible for pathfinding.

◆ Bounds

Bounds Infohazard.HyperNav.NavVolume.Bounds
getset

The boundaries of the volume.

This cannot be set while the game is running.

◆ Data

NavVolumeData Infohazard.HyperNav.NavVolume.Data
getset

The baked data for the volume.

This cannot be set while the game is running.

◆ EnableMultiQuery

bool Infohazard.HyperNav.NavVolume.EnableMultiQuery
getset

Whether to enable multiple physics queries per voxel to get a more accurate result.

◆ InstanceID

long Infohazard.HyperNav.NavVolume.InstanceID
get

The unique ID for this volume to identify it in pathfinding jobs and serialized data.

◆ MaxAgentRadius

float Infohazard.HyperNav.NavVolume.MaxAgentRadius
getset

The maximum size of agents using this volume.

◆ MaxExternalLinkDistance

float Infohazard.HyperNav.NavVolume.MaxExternalLinkDistance
getset

The maximum distance that external links can extend outside of this volume.

◆ ShowVertexNumbers

bool Infohazard.HyperNav.NavVolume.ShowVertexNumbers
getset

Whether to show the vertex numbers of the preview mesh in the scene view (for debugging).

◆ ShowVertexNumbersRange

float Infohazard.HyperNav.NavVolume.ShowVertexNumbersRange
getset

Max distance from the camera at which vertex numbers will be shown.

◆ StartLocations

IReadOnlyList<Vector3> Infohazard.HyperNav.NavVolume.StartLocations
getset

If _useStartLocations is true, which start locations to use.

◆ StaticOnly

bool Infohazard.HyperNav.NavVolume.StaticOnly
getset

Whether only static objects should be included in the baked data.

◆ UseMultithreading

bool Infohazard.HyperNav.NavVolume.UseMultithreading
getset

Whether to use multiple threads when baking the volume.

This should only be turned off for debugging.

◆ UseStartLocations

bool Infohazard.HyperNav.NavVolume.UseStartLocations
getset

Whether only regions connected to certain locations are considered valid.

This can be used to exclude certain regions from a volume, such as regions that are outside reachable area.

◆ VisualizationMode

NavVolumeVisualizationMode Infohazard.HyperNav.NavVolume.VisualizationMode
getset

Stage at which to visualize the volume bake process in the scene view.

◆ VisualizeNeighbors

bool Infohazard.HyperNav.NavVolume.VisualizeNeighbors
getset

Whether to show the connections of a selected region in the scene view.

◆ VisualizeNeighborsRegion

int Infohazard.HyperNav.NavVolume.VisualizeNeighborsRegion
getset

If _visualizeNeighbors is true, which region to visualize in the scene view.

◆ VisualizeVoxelQueries

bool Infohazard.HyperNav.NavVolume.VisualizeVoxelQueries
getset

Whether to visualize the queries that are performed for a voxel when baking.

◆ VolumeChangingCount

int Infohazard.HyperNav.NavVolume.VolumeChangingCount
staticgetprivate set

Number of places that are modifying volume data.

◆ Volumes

IReadOnlyDictionary<long, NavVolume> Infohazard.HyperNav.NavVolume.Volumes
staticget

All currently loaded volumes.

◆ VoxelSize

float Infohazard.HyperNav.NavVolume.VoxelSize
getset

The voxel size of this volume, which determines the precision but also baking cost.

Event Documentation

◆ VolumeDataChanged

Action Infohazard.HyperNav.NavVolume.VolumeDataChanged
static

Event that is invoked immediately after active volume data changes.

◆ VolumeDataChanging

Action Infohazard.HyperNav.NavVolume.VolumeDataChanging
static

Event that is invoked immediately before active volume data changes.


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