Class NavMeshRuntime
The navigation mesh runtime object that builds the navmesh from all loaded scenes.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public class NavMeshRuntime : Object
Constructors
NavMeshRuntime()
Properties
Properties
The navigation mesh properties.
Declaration
[Unmanaged]
public NavMeshProperties Properties { get; }
Property Value
NavMeshProperties
|
TileSize
Gets the size of the tile (in world-units). Returns zero if not initialized yet.
Declaration
[Unmanaged]
public float TileSize { get; }
Property Value
System.Single
|
Methods
FindClosestPoint(Vector3, out Vector3)
Finds the nearest point on a nav mesh surface.
Declaration
[Unmanaged]
public bool FindClosestPoint(Vector3 point, out Vector3 result)
Parameters
Vector3
point
The source point. |
Vector3
result
The result position on the navmesh (valid only if method returns true). |
Returns
System.Boolean
True if found valid location on the navmesh, otherwise false. |
FindDistanceToWall(Vector3, NavMeshHit, Single)
Finds the distance from the specified start position to the nearest polygon wall.
Declaration
[Unmanaged]
public bool FindDistanceToWall(Vector3 startPosition, NavMeshHit hitInfo, float maxDistance = 3.40282347E+38F)
Parameters
Vector3
startPosition
The start position. |
NavMeshHit
hitInfo
The result hit information. Valid only when query succeed. |
System.Single
maxDistance
The maximum distance to search for wall (search radius). |
Returns
System.Boolean
True if ray hits an matching object, otherwise false. |
FindPath(Vector3, Vector3, out Vector3[])
Finds the path between the two positions presented as a list of waypoints stored in the corners array.
Declaration
[Unmanaged]
public bool FindPath(Vector3 startPosition, Vector3 endPosition, out Vector3[] resultPath)
Parameters
Vector3
startPosition
The start position. |
Vector3
endPosition
The end position. |
Vector3[]
resultPath
The result path. |
Returns
System.Boolean
True if found valid path between given two points (it may be partial), otherwise false if failed. |
FindRandomPoint(out Vector3)
Finds random location on nav mesh.
Declaration
[Unmanaged]
public bool FindRandomPoint(out Vector3 result)
Parameters
Vector3
result
The result position on the navmesh (valid only if method returns true). |
Returns
System.Boolean
True if found valid location on the navmesh, otherwise false. |
FindRandomPointAroundCircle(Vector3, Single, out Vector3)
Finds random location on nav mesh within the reach of specified location.
Declaration
[Unmanaged]
public bool FindRandomPointAroundCircle(Vector3 center, float radius, out Vector3 result)
Parameters
Vector3
center
The source point to find random location around it. |
System.Single
radius
The search distance for a random point. Maximum distance for a result point from the center of the circle. |
Vector3
result
The result position on the navmesh (valid only if method returns true). |
Returns
System.Boolean
True if found valid location on the navmesh, otherwise false. |
Get()
Gets the first valid navigation mesh runtime. Return null if none created.
Declaration
[Unmanaged]
public static NavMeshRuntime Get()
Returns
NavMeshRuntime
|
Get(ref NavAgentProperties)
Gets the navigation mesh runtime for a given agent properties trying to pick the best matching navmesh.
Declaration
[Unmanaged]
public static NavMeshRuntime Get(ref NavAgentProperties agentProperties)
Parameters
NavAgentProperties
agentProperties
|
Returns
NavMeshRuntime
|
Get(ref NavMeshProperties, Boolean)
Gets the navigation mesh runtime for a given navmesh properties.
Declaration
[Unmanaged]
public static NavMeshRuntime Get(ref NavMeshProperties navMeshProperties, bool createIfMissing = false)
Parameters
NavMeshProperties
navMeshProperties
|
System.Boolean
createIfMissing
|
Returns
NavMeshRuntime
|
Get(String)
Gets the navigation mesh runtime for a given navmesh name. Return null if missing.
Declaration
[Unmanaged]
public static NavMeshRuntime Get(string navMeshName)
Parameters
System.String
navMeshName
|
Returns
NavMeshRuntime
|
ProjectPoint(Vector3, out Vector3)
Projects the point to nav mesh surface (finds the nearest polygon). [Deprecated in v1.8]
Declaration
[Unmanaged]
public bool ProjectPoint(Vector3 point, out Vector3 result)
Parameters
Vector3
point
The source point. |
Vector3
result
The result position on the navmesh (valid only if method returns true). |
Returns
System.Boolean
True if found valid location on the navmesh, otherwise false. |
RayCast(Vector3, Vector3, out NavMeshHit)
Casts a 'walkability' ray along the surface of the navigation mesh from the start position toward the end position.
Declaration
[Unmanaged]
public bool RayCast(Vector3 startPosition, Vector3 endPosition, out NavMeshHit hitInfo)
Parameters
Vector3
startPosition
The start position. |
Vector3
endPosition
The end position. |
NavMeshHit
hitInfo
The result hit information. Valid only when query succeed. |
Returns
System.Boolean
True if ray hits an matching object, otherwise false. |
TestPath(Vector3, Vector3)
Tests the path between the two positions (non-partial).
Declaration
[Unmanaged]
public bool TestPath(Vector3 startPosition, Vector3 endPosition)
Parameters
Vector3
startPosition
The start position. |
Vector3
endPosition
The end position. |
Returns
System.Boolean
True if found valid path between given two points, otherwise false if failed. |