dtQueryFilter

Defines polygon filtering and traversal costs for navigation mesh query operations.

Windows
MacOS
Linux

References

Module

Navmesh

Header

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

Include

#include "Detour/DetourNavMeshQuery.h"

Syntax

class dtQueryFilter

Remarks

Defines polygon filtering and traversal costs for navigation mesh query operations.

The Default Implementation

At construction: All area costs default to 1.0. All flags are included and none are excluded.

If a polygon has both an include and an exclude flag, it will be excluded.

The way filtering works, a navigation mesh polygon must have at least one flag set to ever be considered by a query. So a polygon with no flags will never be considered.

Setting the include flags to 0 will result in all polygons being excluded.

Custom Implementations

dtQueryFilter.isVIrtual must be true in order to extend this class.

Implement a custom query filter by overriding the virtual passFilter() and getCost() functions. If this is done, both functions should be as fast as possible. Use cached local copies of data rather than accessing your own objects where possible.

Custom implementations do not need to adhere to the flags or cost logic used by the default implementation.

In order for A* searches to work properly, the cost should be proportional to the travel distance. Implementing a cost modifier less than 1.0 is likely to lead to problems during pathfinding.

Variables

Name Description

Protected variable

dtQueryFilterDa...

 

data

Protected variable

bool

 

isVirtual

Constructors

Name Description

Public function

dtQueryFilter

(
    bool inIsVirtual
)

Destructors

Name Description

Public function Virtual

~dtQueryFilter()

Functions

Name Description

Public function

void

 

copyFrom

(
    const dtQueryFilter& other
)

Public function

void

 

copyFrom

(
    const dtQueryFilter* other
)

Copy data values from source filter.

Public function Const

bool

 

equals

(
    const dtQueryFilter* other
)

Check if two filters have the same data values.

Public function Const

bool

 

equals

(
    const dtQueryFilter& other
)

Public function Const

const float ...

 

getAllAreaCosts()

Public function Const

const float ...

 

getAllFixedAreaCosts()

Public function Const

float

 

getAreaCost

(
    const int i
)

Returns the traversal cost of the area.

Public function Const

float

 

getAreaFixedCost

(
    const int i
)

Returns the fixed cost for entering an area.

Public function Const

float

 

getCost

(
    const float* pa,
    const float* pb,
    const dtPolyRef prevRef,
    const dtMeshTile* prevTile,
    const dtPoly* prevPoly,
    const dtPolyRef curRef,
    const dtMeshTile* curTile,
    const dtPoly* curPoly,
    const dtPolyRef nextRef,
    const dtMeshTile* nextTile,
    const dtPoly* nextPoly
)

Returns cost to move from the beginning to the end of a line segment that is fully contained within a polygon.

Public function Const

unsigned sho...

 

getExcludeFlags()

Returns the exclude flags for the filter.

Public function Const

float

 

getHeuristicScale()

Retrieves euclidean distance heuristic scale

Public function Const

unsigned sho...

 

getIncludeFlags()

Returns the include flags for the filter.

Protected function Const

float

 

getInlineCost

(
    const float* pa,
    const float* pb,
    const dtPolyRef prevRef,
    const dtMeshTile* prevTile,
    const dtPoly* prevPoly,
    const dtPolyRef curRef,
    const dtMeshTile* curTile,
    const dtPoly* curPoly,
    const dtPolyRef nextRef,
    const dtMeshTile* nextTile,
    const dtPoly* nextPoly
)

Inlined scoring function.

Public function Const

bool

 

getIsBacktracking()

Retrieves information whether this filter is set up for backtracking

Public function Const

float

 

getModifiedHeuristicScale()

Public function Const

bool

 

getShouldIgnoreClosedNodes()

Retrieves information whether this filter allows reopening closed nodes

Protected function Virtual Const

float

 

getVirtualCost

(
    const float* pa,
    const float* pb,
    const dtPolyRef prevRef,
    const dtMeshTile* prevTile,
    const dtPoly* prevPoly,
    const dtPolyRef curRef,
    const dtMeshTile* curTile,
    const dtPoly* curPoly,
    const dtPolyRef nextRef,
    const dtMeshTile* nextTile,
    const dtPoly* nextPoly
)

Virtual scoring function implementation (defaults to getInlineCost).

Public function Const

bool

 

isValidLinkSide

(
    const unsigned char side
)

Filters link in regards to its side. Used for backtracking.

Public function Const

bool

 

passFilter

(
    const dtPolyRef ref,
    const dtMeshTile* tile,
    const dtPoly* poly
)

Returns true if the polygon can be visited. (I.e. Is traversable.)

Protected function Const

bool

 

passInlineFilter

(
    const dtPolyRef ref,
    const dtMeshTile* tile,
    const dtPoly* poly
)

Inlined filter implementation.

Protected function Virtual Const

bool

 

passVirtualFilter

(
    const dtPolyRef ref,
    const dtMeshTile* tile,
    const dtPoly* poly
)

Virtual filter implementation (defaults to passInlineFilter).

Public function

void

 

setAreaCost

(
    const int i,
    const float cost
)

Sets the traversal cost of the area.

Public function

void

 

setAreaFixedCost

(
    const int i,
    const float cost
)

Sets the fixed cost for entering an area.

Public function

void

 

setExcludeFlags

(
    const unsigned short flags
)

Sets the exclude flags for the filter.

Public function

void

 

setHeuristicScale

(
    const float newScale
)

Set euclidean distance heuristic scale.

Public function

void

 

setIncludeFlags

(
    const unsigned short flags
)

Sets the include flags for the filter.

Public function

void

 

setIsBacktracking

(
    const bool isBacktracking
)

Sets up filter for backtracking.

Public function

void

 

setShouldIgnoreClosedNodes

(
    const bool shouldIgnore
)

Instruct filter whether it can reopen nodes already on closed list.

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