dtNavMeshQuery

Provides the ability to perform pathfinding related queries against a navigation mesh.

Windows
MacOS
Linux

References

Module

Navmesh

Header

/Engine/Source/Runtime/Navmesh/Public/Detour/DetourNavMeshQuery.h

Include

#include "Detour/DetourNavMeshQuery.h"

Syntax

class dtNavMeshQuery

Remarks

Provides the ability to perform pathfinding related queries against a navigation mesh.

For methods that support undersized buffers, if the buffer is too small to hold the entire result set the return status of the method will include the #DT_BUFFER_TOO_SMALL flag.

Constant member functions can be used by multiple clients without side effects. (E.g. No change to the closed list. No impact on an in-progress sliced path query. Etc.)

Walls and portals: A wall is a polygon segment that is considered impassable. A portal is a passable segment between polygons. A portal may be treated as a wall based on the dtQueryFilter used for a query.

Constructors

Name Description

Public function

dtNavMeshQuery()

Destructors

Name Description

Public function

~dtNavMeshQuery()

Functions

Name Description

Public function Const

dtStatus

 

appendPortals

(
    const int startIdx,
    const int endIdx,
    const float* endPos,
    const dtPolyRef* path,
    dtQueryResult& result,
    const int options
)

Appends intermediate portal points to a straight path.

Public function Const

dtStatus

 

appendVertex

(
    const float* pos,
    const unsigned char flags,
    const dtPolyRef ref,
    dtQueryResult& result,
    const bool bOverrideIdenticalPositi...
)

Appends vertex to a straight path.

Public function Const

dtStatus

 

closestPointOnPoly

(
    dtPolyRef ref,
    const float* pos,
    float* closest
)

Finds the closest point on the specified polygon.

Public function Const

dtStatus

 

closestPointOnPolyBoundary

(
    dtPolyRef ref,
    const float* pos,
    float* closest
)

Returns a point on the boundary closest to the source point if the source point is outside the polygon's xz-bounds.

Public function

dtStatus

 

finalizeSlicedFindPath

(
    dtPolyRef* path,
    int* pathCount,
    const int maxPath
)

Finalizes and returns the results of a sliced path query.

Public function

dtStatus

 

finalizeSlicedFindPathPartial

(
    const dtPolyRef* existing,
    const int existingSize,
    dtPolyRef* path,
    int* pathCount,
    const int maxPath
)

Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest polygon on the existing path that was visited during the search.

Public function Const

dtStatus

 

findDistanceToWall

(
    dtPolyRef startRef,
    const float* centerPos,
    const float maxRadius,
    const dtQueryFilter* filter,
    float* hitDist,
    float* hitPos,
    float* hitNormal
)

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

Public function Const

dtStatus

 

findLocalNeighbourhood

(
    dtPolyRef startRef,
    const float* centerPos,
    const float radius,
    const dtQueryFilter* filter,
    dtPolyRef* resultRef,
    dtPolyRef* resultParent,
    int* resultCount,
    const int maxResult
)

Finds the non-overlapping navigation polygons in the local neighbourhood around the center position.

Public function Const

dtStatus

 

findNearestContainingPoly

(
    const float* center,
    const float* extents,
    const dtQueryFilter* filter,
    dtPolyRef* nearestRef,
    float* nearestPt
)

Finds the nearest polygon in height containing the specified center point.

Public function Const

dtStatus

 

findNearestPoly

(
    const float* center,
    const float* extents,
    const dtQueryFilter* filter,
    dtPolyRef* nearestRef,
    float* nearestPt,
    const float* referencePt
)

Finds the polygon nearest to the specified center point.

Public function Const

dtStatus

 

findNearestPoly2D

(
    const float* center,
    const float* extents,
    const dtQueryFilter* filter,
    dtPolyRef* outProjectedRef,
    float* outProjectedPt,
    const float* referencePt,
    float tolerance
)

Finds the polygon 2D-nearest to the specified center point.

Public function Const

dtStatus

 

findPath

(
    dtPolyRef startRef,
    dtPolyRef endRef,
    const float* startPos,
    const float* endPos,
    const float costLimit,
    const dtQueryFilter* filter,
    dtQueryResult& result,
    float* totalCost
)

Finds a path from the start polygon to the end polygon.

Public function Const

dtStatus

 

findPolysAroundCircle

(
    dtPolyRef startRef,
    const float* centerPos,
    const float radius,
    const dtQueryFilter* filter,
    dtPolyRef* resultRef,
    dtPolyRef* resultParent,
    float* resultCost,
    int* resultCount,
    const int maxResult
)

Finds the polygons along the navigation graph that touch the specified circle.

Public function Const

dtStatus

 

findPolysAroundShape

(
    dtPolyRef startRef,
    const float* verts,
    const int nverts,
    const dtQueryFilter* filter,
    dtPolyRef* resultRef,
    dtPolyRef* resultParent,
    float* resultCost,
    int* resultCount,
    const int maxResult
)

Finds the polygons along the naviation graph that touch the specified convex polygon.

Public function Const

dtStatus

 

findPolysInPathDistance

(
    dtPolyRef startRef,
    const float* centerPos,
    const float pathDistance,
    const dtQueryFilter* filter,
    dtPolyRef* resultRef,
    int* resultCount,
    const int maxResult
)

Finds the polygons along the navigation graph that are no more than given path length away from centerPos.

Public function Const

dtStatus

 

findRandomPoint

(
    const dtQueryFilter* filter,
    float(*)() frand,
    dtPolyRef* randomRef,
    float* randomPt
)

Returns random location on navmesh.

Public function Const

dtStatus

 

findRandomPointAroundCircle

(
    dtPolyRef startRef,
    const float* centerPos,
    const float maxRadius,
    const dtQueryFilter* filter,
    float(*)() frand,
    dtPolyRef* randomRef,
    float* randomPt
)

Returns random location on navmesh within the reach of specified location.

Public function Const

dtStatus

 

findStraightPath

(
    const float* startPos,
    const float* endPos,
    const dtPolyRef* path,
    const int pathSize,
    dtQueryResult& result,
    const int options
)

Finds the straight path from the start to the end position within the polygon corridor.

Public function Const

dtStatus

 

findWallsInNeighbourhood

(
    dtPolyRef startRef,
    const float* centerPos,
    const float radius,
    const dtQueryFilter* filter,
    dtPolyRef* neiRefs,
    int* neiCount,
    const int maxNei,
    float* resultWalls,
    dtPolyRef* resultRefs,
    int* resultCount,
    const int maxResult
)

[UE4] Finds the wall segments in local neighbourhood

Public function Const

const dtNavM...

 

getAttachedNavMesh()

Gets the navigation mesh the query object is using.

Public function Const

void

 

getCurrentBestResult

(
    dtNode*& bestNode,
    float& bestCost
)

Gets best node ref and cost from sliced pathfinding data.

Public function Const

dtStatus

 

getEdgeMidPoint

(
    dtPolyRef from,
    const dtPoly* fromPoly,
    const dtMeshTile* fromTile,
    dtPolyRef to,
    const dtPoly* toPoly,
    const dtMeshTile* toTile,
    float* mid
)

Public function Const

dtStatus

 

getEdgeMidPoint

(
    dtPolyRef from,
    dtPolyRef to,
    float* mid
)

Returns edge mid point between two polygons.

Public function Const

dtNodePool &...

 

getNodePool()

Gets the node pool.

Public function Const

dtStatus

 

getPolyHeight

(
    dtPolyRef ref,
    const float* pos,
    float* height
)

Gets the height of the polygon at the provided position using the height detail.

Public function Const

dtStatus

 

getPolyWallSegments

(
    dtPolyRef ref,
    const dtQueryFilter* filter,
    float* segmentVerts,
    dtPolyRef* segmentRefs,
    int* segmentCount,
    const int maxSegments
)

Returns the segments for the specified polygon, optionally including portals.

Public function Const

dtStatus

 

getPortalPoints

(
    dtPolyRef from,
    dtPolyRef to,
    float* left,
    float* right,
    unsigned char& fromType,
    unsigned char& toType
)

Exposing function to be able to generate navigation corridors as sequence of point pairs

Public function Const

dtStatus

 

getPortalPoints

(
    dtPolyRef from,
    const dtPoly* fromPoly,
    const dtMeshTile* fromTile,
    dtPolyRef to,
    const dtPoly* toPoly,
    const dtMeshTile* toTile,
    float* left,
    float* right
)

Public function Const

int

 

getQueryNodes()

Public function

dtStatus

 

init

(
    const dtNavMesh* nav,
    const int maxNodes,
    dtQuerySpecialLinkFilter* link...
)

Initializes the query object.

Public function

dtStatus

 

initSlicedFindPath

(
    dtPolyRef startRef,
    dtPolyRef endRef,
    const float* startPos,
    const float* endPos,
    const float costLimit,
    const dtQueryFilter* filter
)

Initializes a sliced path query.

Public function Const

bool

 

isInClosedList

(
    dtPolyRef ref
)

Returns true if the polygon reference is in the closed list.

Public function Const

dtStatus

 

isPointInsidePoly

(
    dtPolyRef ref,
    const float* pos,
    bool& result
)

Checks if specified pos is inside given polygon specified by ref

Public function Const

bool

 

isValidPolyRef

(
    dtPolyRef ref,
    const dtQueryFilter* filter
)

Returns true if the polygon reference is valid and passes the filter restrictions.

Public function Const

dtStatus

 

moveAlongSurface

(
    dtPolyRef startRef,
    const float* startPos,
    const float* endPos,
    const dtQueryFilter* filter,
    float* resultPos,
    dtPolyRef* visited,
    int* visitedCount,
    const int maxVisitedSize
)

Moves from the start to the end position constrained to the navigation mesh.

Public function Const

bool

 

passLinkFilter

(
    const dtMeshTile* tile,
    const int polyIdx
)

Public function Const

bool

 

passLinkFilterByRef

(
    const dtMeshTile* tile,
    const dtPolyRef ref
)

Public function Const

dtStatus

 

projectedPointOnPoly

(
    dtPolyRef ref,
    const float* pos,
    float* projected
)

Finds the point's projection on the specified polygon.

Public function Const

dtStatus

 

queryPolygons

(
    const float* center,
    const float* extents,
    const dtQueryFilter* filter,
    dtPolyRef* polys,
    int* polyCount,
    const int maxPolys
)

Finds polygons that overlap the search box.

Public function Const

dtStatus

 

raycast

(
    dtPolyRef startRef,
    const float* startPos,
    const float* endPos,
    const dtQueryFilter* filter,
    float* t,
    float* hitNormal,
    dtPolyRef* path,
    int* pathCount,
    const int maxPath
)

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

Public function

void

 

updateLinkFilter

(
    dtQuerySpecialLinkFilter* link...
)

UE4: updates special link filter for this query.

Public function

dtStatus

 

updateSlicedFindPath

(
    const int maxIter,
    int* doneIters
)

Updates an in-progress sliced path query.

Public function Const

bool

 

wasClusterLinkSearched

(
    dtPolyRef cFrom,
    dtPolyRef cTo
)

Returns true if the cluster link was used in previous search.

See Also

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss