Class NavMeshRuntime
The navigation mesh runtime object that builds the navmesh from all loaded scenes.
Assembly: FlaxEngine.dll
File: Engine/Navigation/NavMeshRuntime.h
Syntax
public class NavMeshRuntime : public ScriptingObject
The navigation mesh runtime object that builds the navmesh from all loaded scenes.
public class NavMeshRuntime : public ScriptingObject
public ~NavMeshRuntime()
Projects the point to nav mesh surface (finds the nearest polygon). [Deprecated in v1.8]
public DEPRECATED("Use FindClosestPoint instead") bool ProjectPoint(const Vector3& point
"Use FindClosestPoint instead"
NavMeshRuntime_DEPRECATED__Use_FindClosestPoint_instead__
|
public NavMeshRuntime(const NavMeshProperties& properties)
NavMeshProperties
properties
|
public Vector3result const{
return FindClosestPoint(point, result)
Vector3result
|
The object locker.
public CriticalSection Locker
CriticalSection
|
public static float NavAreasCosts[64]
float
|
The navigation mesh properties.
public NavMeshProperties Properties
NavMeshProperties
|
Adds the tile from the given scene to the runtime navmesh.
public void AddTile(NavMesh* navMesh, NavMeshTileData& tileData)
NavMesh
navMesh
The navigation mesh. |
NavMeshTileData
tileData
The tile data. |
Adds the tiles from the given scene to the runtime navmesh.
public void AddTiles(NavMesh* navMesh)
NavMesh
navMesh
The navigation mesh. |
public void DebugDraw()
Releases the navmesh.
public void Dispose()
Ensures the navmesh capacity for adding new tiles. Performs resizing if needed.
public void EnsureCapacity(int32 tilesToAddCount)
int32
tilesToAddCount
The new tiles amount. |
Finds the nearest point on a nav mesh surface.
public bool FindClosestPoint(const Vector3& point, Vector3& result) const
Vector3
point
The source point. |
Vector3
result
The result position on the navmesh (valid only if method returns true). |
bool
True if found valid location on the navmesh, otherwise false. |
Finds the distance from the specified start position to the nearest polygon wall.
public bool FindDistanceToWall(const Vector3& startPosition, NavMeshHit& hitInfo, float maxDistance=MAX_float) const
Vector3
startPosition
The start position. |
NavMeshHit
hitInfo
The result hit information. Valid only when query succeed. |
float
maxDistance
The maximum distance to search for wall (search radius). |
bool
True if ray hits an matching object, otherwise false. |
Finds the path between the two positions presented as a list of waypoints stored in the corners array.
public bool FindPath(const Vector3& startPosition, const Vector3& endPosition, Array<Vector3, HeapAllocation>& resultPath) const
Vector3
startPosition
The start position. |
Vector3
endPosition
The end position. |
Array<Vector3, HeapAllocation>
resultPath
The result path. |
bool
True if found valid path between given two points (it may be partial), otherwise false if failed. |
Finds the path between the two positions presented as a list of waypoints stored in the corners array.
public bool FindPath(const Vector3& startPosition, const Vector3& endPosition, Array<Vector3, HeapAllocation>& resultPath, NavMeshPathFlags& resultFlags) const
Vector3
startPosition
The start position. |
Vector3
endPosition
The end position. |
Array<Vector3, HeapAllocation>
resultPath
The result path. |
NavMeshPathFlags
resultFlags
The result path flags. |
bool
True if found valid path between given two points (it may be partial), otherwise false if failed. |
Finds random location on nav mesh.
public bool FindRandomPoint(Vector3& result) const
Vector3
result
The result position on the navmesh (valid only if method returns true). |
bool
True if found valid location on the navmesh, otherwise false. |
Finds random location on nav mesh within the reach of specified location.
public bool FindRandomPointAroundCircle(const Vector3& center, float radius, Vector3& result) const
Vector3
center
The source point to find random location around it. |
float
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). |
bool
True if found valid location on the navmesh, otherwise false. |
public static NavMeshRuntime* Get(const NavAgentProperties& agentProperties)
NavAgentProperties
agentProperties
|
NavMeshRuntime
|
public static NavMeshRuntime* Get(const NavMeshProperties& navMeshProperties, bool createIfMissing=false)
NavMeshProperties
navMeshProperties
|
bool
createIfMissing
|
NavMeshRuntime
|
public static NavMeshRuntime* Get(const StringView& navMeshName)
StringView
navMeshName
|
NavMeshRuntime
|
public dtNavMesh* GetNavMesh() const
dtNavMesh
|
public dtNavMeshQuery* GetNavMeshQuery() const
dtNavMeshQuery
|
public int32 GetTilesCapacity() const
int32
|
Gets the size of the tile (in world-units). Returns zero if not initialized yet.
public float GetTileSize() const
float
|
Casts a 'walkability' ray along the surface of the navigation mesh from the start position toward the end position.
public bool RayCast(const Vector3& startPosition, const Vector3& endPosition, NavMeshHit& hitInfo) const
Vector3
startPosition
The start position. |
Vector3
endPosition
The end position. |
NavMeshHit
hitInfo
The result hit information. Valid only when query succeed. |
bool
True if ray hits an matching object, otherwise false. |
Removes the tile from the navmesh.
public void RemoveTile(int32 x, int32 y, int32 layer)
int32
x
The tile X coordinate. |
int32
y
The tile Y coordinate. |
int32
layer
The tile layer. |
Removes all the tiles that custom prediction callback marks.
public void RemoveTiles(bool(*prediction)(const NavMeshRuntime* navMesh, const NavMeshTile& tile, void* customData), void* userData)
bool()(NavMeshRuntime navMesh, NavMeshTiletile, void customData)
prediction
The prediction callback, returns true for tiles to remove and false for tiles to preserve. |
void
userData
The user data passed to the callback method. |
Removes all the tiles from the navmesh that has been added from the given navigation scene.
public void RemoveTiles(NavMesh* navMesh)
NavMesh
navMesh
The navigation mesh. |
Sets the size of the tile (if not assigned). Disposes the mesh if added tiles have different size.
public void SetTileSize(float tileSize)
float
tileSize
The size of the tile. |
Tests the path between the two positions (non-partial).
public bool TestPath(const Vector3& startPosition, const Vector3& endPosition) const
Vector3
startPosition
The start position. |
Vector3
endPosition
The end position. |
bool
True if found valid path between given two points, otherwise false if failed. |