Class Navigation
The navigation service used for path finding and agents navigation system.
Assembly: FlaxEngine.dll
File: Engine/Navigation/Navigation.h
Syntax
public class Navigation
The navigation service used for path finding and agents navigation system.
public class Navigation
Projects the point to nav mesh surface (finds the nearest polygon). [Deprecated in v1.8]
public DEPRECATED("Use FindClosestPoint instead") static bool ProjectPoint(const Vector3& point
"Use FindClosestPoint instead"
Navigation_DEPRECATED__Use_FindClosestPoint_instead__
|
public Vector3 result{
return FindClosestPoint(point, result)
Vector3
|
Builds the Nav Mesh for the given scene (builds only the tiles overlapping the given bounding box).
Requests are enqueued till the next game scripts update. Actual navmesh building in done via Thread Pool tasks in a background to prevent game thread stalls.
public static void BuildNavMesh(Scene* scene, const BoundingBox& dirtyBounds, float timeoutMs=50)
Scene
scene
The scene. |
BoundingBox
dirtyBounds
The bounds in world-space to build overlapping tiles. |
float
timeoutMs
The timeout to wait before building Nav Mesh (in milliseconds). |
Builds the Nav Mesh for the given scene (discards all its tiles).
Requests are enqueued till the next game scripts update. Actual navmesh building in done via Thread Pool tasks in a background to prevent game thread stalls.
public static void BuildNavMesh(Scene* scene, float timeoutMs=50)
Scene
scene
The scene. |
float
timeoutMs
The timeout to wait before building Nav Mesh (in milliseconds). |
Draws the navigation for all the scenes (uses DebugDraw interface).
public static void DrawNavMesh()
Finds the nearest point on a nav mesh surface.
public static bool FindClosestPoint(const Vector3& point, Vector3& result)
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 static bool FindDistanceToWall(const Vector3& startPosition, NavMeshHit& hitInfo, float maxDistance=MAX_float)
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 static bool FindPath(const Vector3& startPosition, const Vector3& endPosition, Array<Vector3, HeapAllocation>& resultPath)
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 random location on nav mesh.
public static bool FindRandomPoint(Vector3& result)
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 static bool FindRandomPointAroundCircle(const Vector3& center, float radius, Vector3& result)
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. |
Gets the navmesh building progress (normalized to range 0-1).
public static float GetNavMeshBuildingProgress()
float
|
Returns true if navigation system is during navmesh building (any request is valid or async task active).
public static bool IsBuildingNavMesh()
bool
|
Casts a 'walkability' ray along the surface of the navigation mesh from the start position toward the end position.
public static bool RayCast(const Vector3& startPosition, const Vector3& endPosition, NavMeshHit& hitInfo)
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. |
Tests the path between the two positions (non-partial).
public static bool TestPath(const Vector3& startPosition, const Vector3& endPosition)
Vector3
startPosition
The start position. |
Vector3
endPosition
The end position. |
bool
True if found valid path between given two points, otherwise false if failed. |