Search Results for

    Show / Hide Table of Contents

    Class Navigation

    The navigation service used for path finding and agents navigation system.

    Inheritance
    Navigation
    Assembly: FlaxEngine.dll
    File: Engine/Navigation/Navigation.h
    Syntax
    public class Navigation

    Constructors

    DEPRECATED("Use FindClosestPoint instead")

    Projects the point to nav mesh surface (finds the nearest polygon). [Deprecated in v1.8]

    Declaration
    public DEPRECATED("Use FindClosestPoint instead") static bool ProjectPoint(const Vector3& point
    Parameters
    "Use FindClosestPoint instead" Navigation_DEPRECATED__Use_FindClosestPoint_instead__

    Fields

    result

    Declaration
    public Vector3 result{
        return FindClosestPoint(point, result)
    Field Value
    Vector3

    Methods

    BuildNavMesh(Scene* scene, const BoundingBox& dirtyBounds, float timeoutMs=50)

    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.

    Declaration
    public static void BuildNavMesh(Scene* scene, const BoundingBox& dirtyBounds, float timeoutMs=50)
    Parameters
    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).

    BuildNavMesh(Scene* scene, float timeoutMs=50)

    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.

    Declaration
    public static void BuildNavMesh(Scene* scene, float timeoutMs=50)
    Parameters
    Scene scene

    The scene.

    float timeoutMs

    The timeout to wait before building Nav Mesh (in milliseconds).

    DrawNavMesh()

    Draws the navigation for all the scenes (uses DebugDraw interface).

    Declaration
    public static void DrawNavMesh()

    FindClosestPoint(const Vector3& point, Vector3& result)

    Finds the nearest point on a nav mesh surface.

    Declaration
    public static bool FindClosestPoint(const Vector3& point, Vector3& result)
    Parameters
    Vector3 point

    The source point.

    Vector3 result

    The result position on the navmesh (valid only if method returns true).

    Returns
    bool

    True if found valid location on the navmesh, otherwise false.

    FindDistanceToWall(const Vector3& startPosition, NavMeshHit& hitInfo, float maxDistance=MAX_float)

    Finds the distance from the specified start position to the nearest polygon wall.

    Declaration
    public static bool FindDistanceToWall(const Vector3& startPosition, NavMeshHit& hitInfo, float maxDistance=MAX_float)
    Parameters
    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).

    Returns
    bool

    True if ray hits an matching object, otherwise false.

    FindPath(const Vector3& startPosition, const Vector3& endPosition, Array<Vector3, HeapAllocation>& resultPath)

    Finds the path between the two positions presented as a list of waypoints stored in the corners array.

    Declaration
    public static bool FindPath(const Vector3& startPosition, const Vector3& endPosition, Array<Vector3, HeapAllocation>& resultPath)
    Parameters
    Vector3 startPosition

    The start position.

    Vector3 endPosition

    The end position.

    Array<Vector3, HeapAllocation> resultPath

    The result path.

    Returns
    bool

    True if found valid path between given two points (it may be partial), otherwise false if failed.

    FindRandomPoint(Vector3& result)

    Finds random location on nav mesh.

    Declaration
    public static bool FindRandomPoint(Vector3& result)
    Parameters
    Vector3 result

    The result position on the navmesh (valid only if method returns true).

    Returns
    bool

    True if found valid location on the navmesh, otherwise false.

    FindRandomPointAroundCircle(const Vector3& center, float radius, Vector3& result)

    Finds random location on nav mesh within the reach of specified location.

    Declaration
    public static bool FindRandomPointAroundCircle(const Vector3& center, float radius, Vector3& result)
    Parameters
    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).

    Returns
    bool

    True if found valid location on the navmesh, otherwise false.

    GetNavMeshBuildingProgress()

    Gets the navmesh building progress (normalized to range 0-1).

    Declaration
    public static float GetNavMeshBuildingProgress()
    Returns
    float

    IsBuildingNavMesh()

    Returns true if navigation system is during navmesh building (any request is valid or async task active).

    Declaration
    public static bool IsBuildingNavMesh()
    Returns
    bool

    RayCast(const Vector3& startPosition, const Vector3& endPosition, NavMeshHit& hitInfo)

    Casts a 'walkability' ray along the surface of the navigation mesh from the start position toward the end position.

    Declaration
    public static bool RayCast(const Vector3& startPosition, const Vector3& endPosition, 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
    bool

    True if ray hits an matching object, otherwise false.

    TestPath(const Vector3& startPosition, const Vector3& endPosition)

    Tests the path between the two positions (non-partial).

    Declaration
    public static bool TestPath(const Vector3& startPosition, const Vector3& endPosition)
    Parameters
    Vector3 startPosition

    The start position.

    Vector3 endPosition

    The end position.

    Returns
    bool

    True if found valid path between given two points, otherwise false if failed.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat