detour

package
v0.0.0-...-208d128 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/// The maximum number of vertices per navigation polygon.
	/// @ingroup detour
	DT_VERTS_PER_POLYGON = 6
	DT_NULL_LINK         = 0xffffffff

	/// A flag that indicates that an entity links to an external entity.
	/// (E.g. A polygon edge is a portal that links to another polygon.)
	DT_EXT_LINK                   = 0x8000
	DT_RAY_CAST_LIMIT_PROPORTIONS = 50.0
	/// A flag that indicates that an off-mesh connection can be traversed in both directions. (Is bidirectional.)
	DT_OFFMESH_CON_BIDIR = 1

	/// A magic number used to detect compatibility of navigation tile data.
	DT_NAVMESH_MAGIC = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V'

	/// A version number used to detect compatibility of navigation tile data.
	DT_NAVMESH_VERSION = 7

	/// A magic number used to detect the compatibility of navigation tile states.
	DT_NAVMESH_STATE_MAGIC = 'D'<<24 | 'N'<<16 | 'M'<<8 | 'S'

	/// A version number used to detect compatibility of navigation tile states.
	DT_NAVMESH_STATE_VERSION = 1
	/// The maximum number of user defined area ids.
	/// @ingroup detour
	DT_MAX_AREAS = 64
)
View Source
const (
	/// Flags representing the type of a navigation mesh polygon.
	/// The polygon is a standard convex polygon that is part of the surface of the mesh.
	DT_POLYTYPE_GROUND = 0
	/// The polygon is an off-mesh connection consisting of two vertices.
	DT_POLYTYPE_OFFMESH_CONNECTION = 1
)
View Source
const (
	DT_NODE_OPEN            = 0x01
	DT_NODE_CLOSED          = 0x02
	DT_NODE_PARENT_DETACHED = 0x04 // parent of the node is not adjacent. Found using raycast.
)
View Source
const (
	DT_NODE_PARENT_BITS    = 24
	DT_NODE_STATE_BITS     = 2
	DT_MAX_STATES_PER_NODE = 1 << DT_NODE_STATE_BITS // number of extra states per node. See DtNode::state
)
View Source
const (
	H_SCALE = 0.999 // Search heuristic scale.

	/// Vertex flags returned by DtNavMeshQuery::findStraightPath.
	DT_STRAIGHTPATH_START              = 0x01 ///< The vertex is the start position in the path.
	DT_STRAIGHTPATH_END                = 0x02 ///< The vertex is the end position in the path.
	DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04 ///< The vertex is the start of an off-mesh connection.

)
View Source
const (
	/// Options for DtNavMeshQuery::findStraightPath.
	DT_STRAIGHTPATH_AREA_CROSSINGS = 0x01 ///< Add a vertex at every polygon edge crossing where area changes.
	DT_STRAIGHTPATH_ALL_CROSSINGS  = 0x02 ///< Add a vertex at every polygon edge crossing.
)
View Source
const (
	// High level status.
	DT_FAILURE     = 1 << 31 // Operation failed.
	DT_SUCCESS     = 1 << 30 // Operation succeed.
	DT_IN_PROGRESS = 1 << 29 // Operation still in progress.

	// Detail information for status.
	DT_STATUS_DETAIL_MASK = 0x0ffffff
	DT_WRONG_MAGIC        = 1 << 0 // Input data is not recognized.
	DT_WRONG_VERSION      = 1 << 1 // Input data is in wrong version.
	DT_OUT_OF_MEMORY      = 1 << 2 // Operation ran out of memory.
	DT_INVALID_PARAM      = 1 << 3 // An input parameter was invalid.
	DT_BUFFER_TOO_SMALL   = 1 << 4 // Result buffer for the query was too small to store all results.
	DT_OUT_OF_NODES       = 1 << 5 // Query ran out of nodes during search.
	DT_PARTIAL_RESULT     = 1 << 6 // Query did not reach the end location, returning best guess.
	DT_ALREADY_OCCUPIED   = 1 << 7 // A tile has already been assigned to the given x,y coordinate
)
View Source
const (
	DT_DETAIL_EDGE_BOUNDARY = 0x01 ///< Detail triangle edge is part of the poly boundary

)
View Source
const (
	DT_FINDPATH_ANY_ANGLE = 0x02 ///< use raycasts during pathfind to "shortcut" (raycast still consider costs)
)
View Source
const (
	DT_NULL_IDX = DtNodeIndex(^0)
)
View Source
const (
	DT_RAYCAST_USE_COSTS = 0x01 ///< Raycast should calculate movement cost along the ray and fill RaycastHit::cost

)
View Source
const (

	/// The navigation mesh owns the tile memory and is responsible for freeing it.
	DT_TILE_FREE_DATA = 0x01
)
View Source
const MESH_NULL_IDX = 0xffff

Variables

View Source
var (
	// Undefine (or define in a build config) the following line to use 64bit polyref.
	// Generally not needed, useful for very large worlds.
	// Note: tiles build using 32bit refs are not compatible with 64bit refs!
	DT_POLYREF64 = 1
	DT_SALT_BITS = 16
	DT_TILE_BITS = 28
	DT_POLY_BITS = 20
)
View Source
var (
	DT_VIRTUAL_QUERYFILTER = 1
)

Functions

func DtDistancePtSegSqr2D

func DtDistancePtSegSqr2D[T float64 | float32](pt, p, q []T) (t T, res T)

func DtGetDetailTriEdgeFlags

func DtGetDetailTriEdgeFlags(triFlags uint8, edgeIndex int32) int32

/ Get flags for edge in detail triangle. / @param[in] triFlags The flags for the triangle (last component of detail vertices above). / @param[in] edgeIndex The index of the first vertex of the edge. For instance, if 0, / returns flags for edge AB.

func InitMesh

func InitMesh(dT_POLYREF64 int)

func NewDtNavMesh

func NewDtNavMesh(data *NavMeshData, flags int32) (m IDtNavMesh, result DtTileRef, status DtStatus)

/ Initializes the navigation mesh for single tile use. / @param[in] data Data of the new tile. (See: #dtCreateNavMeshData) / @param[in] dataSize The data size of the new tile. / @param[in] flags The tile flags. (See: #dtTileFlags) / @return The status flags for the operation. / @see dtCreateNavMeshData

func NewDtNavMeshWithParams

func NewDtNavMeshWithParams(params *NavMeshParams) (m IDtNavMesh, status DtStatus)

/ Initializes the navigation mesh for tiled use. / @param[in] params Initialization parameters. / @return The status flags for the operation.

Types

type BVItem

type BVItem struct {
	// contains filtered or unexported fields
}

type DtBVNode

type DtBVNode struct {
	Bmin [3]uint16 ///< Minimum bounds of the node's AABB. [(x, y, z)]
	Bmax [3]uint16 ///< Maximum bounds of the node's AABB. [(x, y, z)]
	I    int32     ///< The node's index. (Negative for escape sequence.)
}

/ Bounding volume node. / @note This structure is rarely if ever used by the end user. / @see DtMeshTile

func (*DtBVNode) FromBin

func (d *DtBVNode) FromBin(w *rw.ReaderWriter) *DtBVNode

func (*DtBVNode) ToBin

func (d *DtBVNode) ToBin(w *rw.ReaderWriter)
type DtLink struct {
	Ref  DtPolyRef ///< Neighbour reference. (The neighbor that is linked to.)
	Next uint32    ///< Index of the next link.
	Edge uint8     ///< Index of the polygon edge that owns this link.
	Side uint8     ///< If a boundary link, defines on which side the link is.
	Bmin uint8     ///< If a boundary link, defines the minimum sub-edge area.
	Bmax uint8     ///< If a boundary link, defines the maximum sub-edge area.
}

Defines a link between polygons. / @note This structure is rarely if ever used by the end user. / @see DtMeshTile

func (*DtLink) FromBin

func (d *DtLink) FromBin(w *rw.ReaderWriter) *DtLink

func (*DtLink) ToBin

func (d *DtLink) ToBin(w *rw.ReaderWriter)

type DtMeshHeader

type DtMeshHeader struct {
	Magic           int32  ///< Tile magic number. (Used to identify the data format.)
	Version         int32  ///< Tile data format version number.
	X               int32  ///< The x-position of the tile within the DtNavMesh tile grid. (x, y, layer)
	Y               int32  ///< The y-position of the tile within the DtNavMesh tile grid. (x, y, layer)
	Layer           int32  ///< The layer of the tile within the DtNavMesh tile grid. (x, y, layer)
	UserId          uint32 ///< The user defined id of the tile.
	PolyCount       int32  ///< The number of polygons in the tile.
	VertCount       int32  ///< The number of vertices in the tile.
	MaxLinkCount    int32  ///< The number of allocated links.
	DetailMeshCount int32  ///< The number of sub-meshes in the detail mesh.

	/// The number of unique vertices in the detail mesh. (In addition to the polygon vertices.)
	DetailVertCount int32

	DetailTriCount  int32      ///< The number of triangles in the detail mesh.
	BvNodeCount     int32      ///< The number of bounding volume nodes. (Zero if bounding volumes are disabled.)
	OffMeshConCount int32      ///< The number of off-mesh connections.
	OffMeshBase     int32      ///< The index of the first polygon which is an off-mesh connection.
	WalkableHeight  float32    ///< The height of the agents using the tile.
	WalkableRadius  float32    ///< The radius of the agents using the tile.
	WalkableClimb   float32    ///< The maximum climb height of the agents using the tile.
	Bmin            [3]float32 ///< The minimum bounds of the tile's AABB. [(x, y, z)]
	Bmax            [3]float32 ///< The maximum bounds of the tile's AABB. [(x, y, z)]

	/// The bounding volume quantization factor.
	BvQuantFactor float32
}

/ Provides high level information related to a DtMeshTile object. / @ingroup detour

func (*DtMeshHeader) FromBin

func (d *DtMeshHeader) FromBin(w *rw.ReaderWriter) *DtMeshHeader

func (*DtMeshHeader) Size

func (d *DtMeshHeader) Size() int

func (*DtMeshHeader) ToBin

func (d *DtMeshHeader) ToBin(w *rw.ReaderWriter)

type DtMeshTile

type DtMeshTile struct {
	Header       *DtMeshHeader   ///< The tile header.
	Polys        []*DtPoly       ///< The tile polygons. [Size: DtMeshHeader::polyCount]
	Verts        []float32       ///< The tile vertices. [(x, y, z) * DtMeshHeader::vertCount]
	Links        []*DtLink       ///< The tile links. [Size: DtMeshHeader::maxLinkCount]
	DetailMeshes []*DtPolyDetail ///< The tile's detail sub-meshes. [Size: DtMeshHeader::detailMeshCount]

	/// The detail mesh's unique vertices. [(x, y, z) * DtMeshHeader::detailVertCount]
	DetailVerts []float32

	/// The detail mesh's triangles. [(vertA, vertB, vertC, triFlags) * DtMeshHeader::detailTriCount].
	/// See dtDetailTriEdgeFlags and dtGetDetailTriEdgeFlags.
	DetailTris []uint8

	/// The tile bounding volume nodes. [Size: DtMeshHeader::bvNodeCount]
	/// (Will be null if bounding volumes are disabled.)
	BvTree []*DtBVNode

	OffMeshCons []*DtOffMeshConnection ///< The tile off-mesh connections. [Size: DtMeshHeader::offMeshConCount]
	Flags       int32                  ///< Tile flags. (See: #dtTileFlags)
	Next        *DtMeshTile            ///< The next free tile, or the next tile in the spatial grid.
	//存储的数据
	Data *NavMeshData
	// contains filtered or unexported fields
}

/ Defines a navigation mesh tile. / @ingroup detour

func (*DtMeshTile) GetIndexByPloy

func (d *DtMeshTile) GetIndexByPloy(ploy *DtPoly) int

type DtNavMesh

type DtNavMesh struct {
	// contains filtered or unexported fields
}

func (*DtNavMesh) AddTile

func (mesh *DtNavMesh) AddTile(data *NavMeshData, flags int32, lastRef DtTileRef) (result DtTileRef, status DtStatus)

/ @par / / The add operation will fail if the data is in the wrong format, the allocated tile / space is full, or there is a tile already at the specified reference. / / The lastRef parameter is used to restore a tile with the same tile / reference it had previously used. In this case the #DtPolyRef's for the / tile will be restored to the same values they were before the tile was / removed. / / The nav mesh assumes exclusive access to the data passed and will make / changes to the dynamic portion of the data. For that reason the data / should not be reused in other nav meshes until the tile has been successfully / removed from this nav mesh. / / @see dtCreateNavMeshData, #removeTile

func (*DtNavMesh) CalcTileLoc

func (mesh *DtNavMesh) CalcTileLoc(pos []float32) (tx, ty int32)

func (*DtNavMesh) ClosestPointOnPoly

func (mesh *DtNavMesh) ClosestPointOnPoly(ref DtPolyRef, pos []float32, closest []float32, posOverPoly *bool)
func (mesh *DtNavMesh) ConnectExtOffMeshLinks(tile *DtMeshTile, target *DtMeshTile, side int32)

func (*DtNavMesh) DecodePolyId

func (mesh *DtNavMesh) DecodePolyId(r DtPolyRef) (salt, it, ip uint32)

/ Decodes a standard polygon reference. / @note This function is generally meant for internal use only. / @param[in] ref The polygon reference to decode. / @param[out] salt The tile's salt value. / @param[out] it The index of the tile. / @param[out] ip The index of the polygon within the tile. / @see #encodePolyId

func (*DtNavMesh) DecodePolyIdPoly

func (mesh *DtNavMesh) DecodePolyIdPoly(ref DtPolyRef) uint32

func (*DtNavMesh) DecodePolyIdSalt

func (mesh *DtNavMesh) DecodePolyIdSalt(ref DtPolyRef) uint32

/ Extracts a tile's salt value from the specified polygon reference. / @note This function is generally meant for internal use only. / @param[in] ref The polygon reference. / @see #encodePolyId

func (*DtNavMesh) DecodePolyIdTile

func (mesh *DtNavMesh) DecodePolyIdTile(ref DtPolyRef) uint32

func (*DtNavMesh) EncodePolyId

func (mesh *DtNavMesh) EncodePolyId(salt, it, ip uint32) DtPolyRef

/ Derives a standard polygon reference. / @note This function is generally meant for internal use only. / @param[in] salt The tile's salt value. / @param[in] it The index of the tile. / @param[in] ip The index of the polygon within the tile.

func (*DtNavMesh) FindConnectingPolys

func (mesh *DtNavMesh) FindConnectingPolys(va, vb []float32, tile *DtMeshTile, side int32, maxcon int32) (con []DtPolyRef, conarea []float32, n int32)

////////////////////////////////////////////////////////////////////////////////////////

func (*DtNavMesh) FindNearestPolyInTile

func (mesh *DtNavMesh) FindNearestPolyInTile(tile *DtMeshTile, center []float32, halfExtents []float32) (nearestPt []float32, nearest DtPolyRef)

func (*DtNavMesh) GetMaxTiles

func (mesh *DtNavMesh) GetMaxTiles() int32

func (*DtNavMesh) GetOffMeshConnectionByRef

func (mesh *DtNavMesh) GetOffMeshConnectionByRef(ref DtPolyRef) *DtOffMeshConnection

func (*DtNavMesh) GetOffMeshConnectionPolyEndPoints

func (mesh *DtNavMesh) GetOffMeshConnectionPolyEndPoints(prevRef DtPolyRef, polyRef DtPolyRef, startPos []float32, endPos []float32) DtStatus

/ @par / / Off-mesh connections are stored in the navigation mesh as special 2-vertex / polygons with a single edge. At least one of the vertices is expected to be / inside a normal polygon. So an off-mesh connection is "entered" from a / normal polygon at one of its endpoints. This is the polygon identified by / the prevRef parameter.

func (*DtNavMesh) GetParams

func (mesh *DtNavMesh) GetParams() *NavMeshParams

/ @par / / @note The parameters are created automatically when the single tile / initialization is performed.

func (*DtNavMesh) GetPolyArea

func (mesh *DtNavMesh) GetPolyArea(ref DtPolyRef) (resultArea uint8, status DtStatus)

func (*DtNavMesh) GetPolyFlags

func (mesh *DtNavMesh) GetPolyFlags(ref DtPolyRef) (resultFlags uint16, status DtStatus)

func (*DtNavMesh) GetPolyHeight

func (mesh *DtNavMesh) GetPolyHeight(tile *DtMeshTile, poly *DtPoly, pos []float32) (height float32, ok bool)

func (*DtNavMesh) GetPolyRefBase

func (mesh *DtNavMesh) GetPolyRefBase(tile *DtMeshTile) DtPolyRef

func (*DtNavMesh) GetTile

func (mesh *DtNavMesh) GetTile(i int) *DtMeshTile

func (*DtNavMesh) GetTileAndPolyByRef

func (mesh *DtNavMesh) GetTileAndPolyByRef(ref DtPolyRef) (tile *DtMeshTile, poly *DtPoly, status DtStatus)

func (*DtNavMesh) GetTileAndPolyByRefUnsafe

func (mesh *DtNavMesh) GetTileAndPolyByRefUnsafe(ref DtPolyRef) (tile *DtMeshTile, poly *DtPoly)

/ @par / / @warning Only use this function if it is known that the provided polygon / reference is valid. This function is faster than #getTileAndPolyByRef, but / it does not validate the reference.

func (*DtNavMesh) GetTileAt

func (mesh *DtNavMesh) GetTileAt(x, y, layer int32) *DtMeshTile

func (*DtNavMesh) GetTileByRef

func (mesh *DtNavMesh) GetTileByRef(ref DtTileRef) *DtMeshTile

func (*DtNavMesh) GetTileRef

func (mesh *DtNavMesh) GetTileRef(tile *DtMeshTile) DtTileRef

func (*DtNavMesh) GetTileRefAt

func (mesh *DtNavMesh) GetTileRefAt(x, y, layer int32) DtTileRef

func (*DtNavMesh) GetTilesAt

func (mesh *DtNavMesh) GetTilesAt(x, y int32, maxTiles int32) ([]*DtMeshTile, int32)

func (*DtNavMesh) IsValidPolyRef

func (mesh *DtNavMesh) IsValidPolyRef(ref DtPolyRef) bool

func (*DtNavMesh) QueryPolygonsInTile

func (mesh *DtNavMesh) QueryPolygonsInTile(tile *DtMeshTile, qmin []float32, qmax []float32, maxPolys int32) (polys []DtPolyRef, n int32)

func (*DtNavMesh) RemoveTile

func (mesh *DtNavMesh) RemoveTile(ref DtTileRef) (data *NavMeshData, status DtStatus)

/ @par / / This function returns the data for the tile so that, if desired, / it can be added back to the navigation mesh at a later point. / / @see #addTile

func (*DtNavMesh) RestoreTileState

func (mesh *DtNavMesh) RestoreTileState(tile *DtMeshTile, tileState *dtTileState, polyStates []*dtPolyState, maxDataSize int32) DtStatus

/ @par / / Tile state includes non-structural data such as polygon flags, area ids, etc. / @note This function does not impact the tile's #DtTileRef and #DtPolyRef's. / @see #storeTileState

func (*DtNavMesh) SetPolyArea

func (mesh *DtNavMesh) SetPolyArea(ref DtPolyRef, area uint8) DtStatus

func (*DtNavMesh) SetPolyFlags

func (mesh *DtNavMesh) SetPolyFlags(ref DtPolyRef, flags uint16) DtStatus

type DtNavMeshCreateParams

type DtNavMeshCreateParams struct {
	Verts     []uint16 ///< The polygon mesh vertices. [(x, y, z) * #vertCount] [Unit: vx]
	VertCount int32    ///< The number vertices in the polygon mesh. [Limit: >= 3]
	Polys     []uint16 ///< The polygon data. [Size: #polyCount * 2 * #nvp]
	PolyFlags []uint16 ///< The user defined flags assigned to each polygon. [Size: #polyCount]
	PolyAreas []uint8  ///< The user defined area ids assigned to each polygon. [Size: #polyCount]
	PolyCount int32    ///< Number of polygons in the mesh. [Limit: >= 1]
	Nvp       int32    ///< Number maximum number of vertices per polygon. [Limit: >= 3]

	DetailMeshes     []uint32  ///< The height detail sub-mesh data. [Size: 4 * #polyCount]
	DetailVerts      []float32 ///< The detail mesh vertices. [Size: 3 * #detailVertsCount] [Unit: wu]
	DetailVertsCount int32     ///< The number of vertices in the detail mesh.
	DetailTris       []uint8   ///< The detail mesh triangles. [Size: 4 * #detailTriCount]
	DetailTriCount   int32     ///< The number of triangles in the detail mesh.

	/// Off-mesh connection vertices. [(ax, ay, az, bx, by, bz) * #offMeshConCount] [Unit: wu]
	OffMeshConVerts []float32
	/// Off-mesh connection radii. [Size: #offMeshConCount] [Unit: wu]
	OffMeshConRad []float32
	/// User defined flags assigned to the off-mesh connections. [Size: #offMeshConCount]
	OffMeshConFlags []uint16
	/// User defined area ids assigned to the off-mesh connections. [Size: #offMeshConCount]
	OffMeshConAreas []uint8
	/// The permitted travel direction of the off-mesh connections. [Size: #offMeshConCount]
	///
	/// 0 = Travel only from endpoint A to endpoint B.<br/>
	/// #DT_OFFMESH_CON_BIDIR = Bidirectional travel.
	OffMeshConDir []uint8
	/// The user defined ids of the off-mesh connection. [Size: #offMeshConCount]
	OffMeshConUserID []uint32
	/// The number of off-mesh connections. [Limit: >= 0]
	OffMeshConCount int32

	UserId    uint32     ///< The user defined id of the tile.
	TileX     int32      ///< The tile's x-grid location within the multi-tile destination mesh. (Along the x-axis.)
	TileY     int32      ///< The tile's y-grid location within the multi-tile destination mesh. (Along the z-axis.)
	TileLayer int32      ///< The tile's layer within the layered destination mesh. [Limit: >= 0] (Along the y-axis.)
	Bmin      [3]float32 ///< The minimum bounds of the tile. [(x, y, z)] [Unit: wu]
	Bmax      [3]float32 ///< The maximum bounds of the tile. [(x, y, z)] [Unit: wu]

	WalkableHeight float32 ///< The agent height. [Unit: wu]
	WalkableRadius float32 ///< The agent radius. [Unit: wu]
	WalkableClimb  float32 ///< The agent maximum traversable ledge. (Up/Down) [Unit: wu]
	Cs             float32 ///< The xz-plane cell size of the polygon mesh. [Limit: > 0] [Unit: wu]
	Ch             float32 ///< The y-axis cell height of the polygon mesh. [Limit: > 0] [Unit: wu]

	/// True if a bounding volume tree should be built for the tile.
	/// @note The BVTree is not normally needed for layered navigation meshes.
	BuildBvTree bool
}

/ Represents the source data used to build an navigation mesh tile. / @ingroup detour

type DtNavMeshQuery

type DtNavMeshQuery struct {
	// contains filtered or unexported fields
}

func (*DtNavMeshQuery) ClosestPointOnPoly

func (query *DtNavMeshQuery) ClosestPointOnPoly(ref DtPolyRef, pos []float32, closest []float32, posOverPoly *bool) (status DtStatus)

//////////////////////////////////////////////////////////////////////////////////////// 查找目标点与指定polygon最近的点 / @par / / Uses the detail polygons to find the surface height. (Most accurate.) / / @p pos does not have to be within the bounds of the polygon or navigation mesh. / / See closestPointOnPolyBoundary() for a limited but faster option. /

func (*DtNavMeshQuery) ClosestPointOnPolyBoundary

func (query *DtNavMeshQuery) ClosestPointOnPolyBoundary(ref DtPolyRef, pos []float32) (closest []float32, status DtStatus)

/ @par / / Much faster than closestPointOnPoly(). / / If the provided position lies within the polygon's xz-bounds (above or below), / then @p pos and @p closest will be equal. / / The height of @p closest will be the polygon boundary. The height detail is not used. / / @p pos does not have to be within the bounds of the polybon or the navigation mesh. /

func (*DtNavMeshQuery) FinalizeSlicedFindPath

func (q *DtNavMeshQuery) FinalizeSlicedFindPath(path []DtPolyRef, maxPath int32) (pathCount int32, status DtStatus)

func (*DtNavMeshQuery) FinalizeSlicedFindPathPartial

func (q *DtNavMeshQuery) FinalizeSlicedFindPathPartial(existing []DtPolyRef, existingSize int32,
	path []DtPolyRef, maxPath int32) (pathCount int32, status DtStatus)

func (*DtNavMeshQuery) FindDistanceToWall

func (q *DtNavMeshQuery) FindDistanceToWall(startRef DtPolyRef, centerPos []float32, maxRadius float32,
	filter *DtQueryFilter, hitDist *float32, hitPos []float32, hitNormal []float32) (status DtStatus)

/ @par / / @p hitPos is not adjusted using the height detail data. / / @p hitDist will equal the search radius if there is no wall within the / radius. In this case the values of @p hitPos and @p hitNormal are / undefined. / / The normal will become unpredicable if @p hitDist is a very small number. /

func (*DtNavMeshQuery) FindLocalNeighbourhood

func (q *DtNavMeshQuery) FindLocalNeighbourhood(startRef DtPolyRef, centerPos []float32, radius float32,
	filter *DtQueryFilter,
	resultRef []DtPolyRef, resultParent []DtPolyRef, maxResult int32) (resultCount int32, status DtStatus)

/ @par / / This method is optimized for a small search radius and small number of result / polygons. / / Candidate polygons are found by searching the navigation graph beginning at / the start polygon. / / The same intersection test restrictions that apply to the findPolysAroundCircle / mehtod applies to this method. / / The value of the center point is used as the start point for cost calculations. / It is not projected onto the surface of the mesh, so its y-value will effect / the costs. / / Intersection tests occur in 2D. All polygons and the search circle are / projected onto the xz-plane. So the y-value of the center point does not / effect intersection tests. / / If the result arrays are is too small to hold the entire result set, they will / be filled to capacity. /

func (*DtNavMeshQuery) FindNearestPoly

func (q *DtNavMeshQuery) FindNearestPoly(center, halfExtents []float32, filter *DtQueryFilter, nearestPt []float32) (nearestRef DtPolyRef, status DtStatus)

/ @par / / @note If the search box does not intersect any polygons the search will / return #DT_SUCCESS, but @p nearestRef will be zero. So if in doubt, check / @p nearestRef before using @p nearestPt. /

func (*DtNavMeshQuery) FindNearestPoly1

func (q *DtNavMeshQuery) FindNearestPoly1(center, halfExtents []float32,
	filter *DtQueryFilter, nearestPt []float32) (nearestRef DtPolyRef, isOverPoly bool, status DtStatus)

If center and nearestPt point to an equal position, isOverPoly will be true; however there's also a special case of climb height inside the polygon (see dtFindNearestPolyQuery)

func (*DtNavMeshQuery) FindPath

func (q *DtNavMeshQuery) FindPath(startRef, endRef DtPolyRef,
	startPos, endPos []float32, filter *DtQueryFilter, path []DtPolyRef, maxPath int32) (pathCount int32, status DtStatus)

/ @par / / If the end polygon cannot be reached through the navigation graph, / the last polygon in the path will be the nearest the end polygon. / / If the path array is to small to hold the full result, it will be filled as / far as possible from the start polygon toward the end polygon. / / The start and end positions are used to calculate traversal costs. / (The y-values impact the result.) /

func (*DtNavMeshQuery) FindPolysAroundCircle

func (q *DtNavMeshQuery) FindPolysAroundCircle(startRef DtPolyRef, centerPos []float32, radius float32,
	filter *DtQueryFilter, resultRef []DtPolyRef, resultParent []DtPolyRef, resultCost []float32, resultCount *int32, maxResult int32) (status DtStatus)

func (*DtNavMeshQuery) FindPolysAroundShape

func (q *DtNavMeshQuery) FindPolysAroundShape(startRef DtPolyRef, verts []float32, nverts int32,
	filter *DtQueryFilter,
	resultRef []DtPolyRef, resultParent []DtPolyRef, resultCost []float32, maxResult int32) (resultCount int32, status DtStatus)

/ @par / / The order of the result set is from least to highest cost. / / At least one result array must be provided. / / A common use case for this method is to perform Dijkstra searches. / Candidate polygons are found by searching the graph beginning at the start / polygon. / / The same intersection test restrictions that apply to findPolysAroundCircle() / method apply to this method. / / The 3D centroid of the search polygon is used as the start position for cost / calculations. / / Intersection tests occur in 2D. All polygons are projected onto the / xz-plane. So the y-values of the vertices do not effect intersection tests. / / If the result arrays are is too small to hold the entire result set, they will / be filled to capacity. /

func (*DtNavMeshQuery) FindRandomPoint

func (query *DtNavMeshQuery) FindRandomPoint(filter *DtQueryFilter) (randomRef DtPolyRef, randomPt []float32, status DtStatus)

/ Returns random location on navmesh. / Polygons are chosen weighted by area. The search runs in linear related to number of polygon. / @param[in] filter The polygon filter to apply to the query. / @param[in] frand Function returning a random number [0..1). / @param[out] randomRef The reference id of the random location. / @param[out] randomPt The random location. / @returns The status flags for the query.

func (*DtNavMeshQuery) FindRandomPointAroundCircle

func (query *DtNavMeshQuery) FindRandomPointAroundCircle(startRef DtPolyRef, centerPos []float32, maxRadius float32,
	filter *DtQueryFilter) (randomRef DtPolyRef, randomPt []float32, status DtStatus)

func (*DtNavMeshQuery) FindStraightPath

func (q *DtNavMeshQuery) FindStraightPath(startPos, endPos []float32,
	path []DtPolyRef, pathSize int32,
	straightPath []float32, straightPathFlags []int32, straightPathRefs []DtPolyRef,
	maxStraightPath int32, optionss ...int32) (straightPathCount int32, status DtStatus)

/ @par / / This method peforms what is often called 'string pulling'. / / The start position is clamped to the first polygon in the path, and the / end position is clamped to the last. So the start and end positions should / normally be within or very near the first and last polygons respectively. / / The returned polygon references represent the reference id of the polygon / that is entered at the associated path position. The reference id associated / with the end point will always be zero. This allows, for example, matching / off-mesh link points to their representative polygons. / / If the provided result buffers are too small for the entire result set, / they will be filled as far as possible from the start toward the end / position. /

func (*DtNavMeshQuery) GetAttachedNavMesh

func (query *DtNavMeshQuery) GetAttachedNavMesh() IDtNavMesh

/ Gets the navigation mesh the query object is using. / @return The navigation mesh the query object is using.

func (*DtNavMeshQuery) GetNodePool

func (query *DtNavMeshQuery) GetNodePool() *DtNodePool

/ Gets the node pool. / @returns The node pool.

func (*DtNavMeshQuery) GetPathFromDijkstraSearch

func (q *DtNavMeshQuery) GetPathFromDijkstraSearch(endRef DtPolyRef, path []DtPolyRef, maxPath int32) (pathCount int32, status DtStatus)

func (*DtNavMeshQuery) GetPolyHeight

func (q *DtNavMeshQuery) GetPolyHeight(ref DtPolyRef, pos []float32) (height float32, status DtStatus)

/ @par / / Will return #DT_FAILURE | DT_INVALID_PARAM if the provided position is outside the xz-bounds / of the polygon. /

func (*DtNavMeshQuery) GetPolyWallSegments

func (q *DtNavMeshQuery) GetPolyWallSegments(ref DtPolyRef, filter *DtQueryFilter,
	segmentVerts []float32, segmentRefs []DtPolyRef,
	maxSegments int32) (segmentCount int32, status DtStatus)

/ @par / / If the @p segmentRefs parameter is provided, then all polygon segments will be returned. / Otherwise only the wall segments are returned. / / A segment that is normally a portal will be included in the result set as a / wall if the @p filter results in the neighbor polygon becoomming impassable. / / The @p segmentVerts and @p segmentRefs buffers should normally be sized for the / maximum segments per polygon of the source navigation mesh. /

func (*DtNavMeshQuery) InitSlicedFindPath

func (q *DtNavMeshQuery) InitSlicedFindPath(startRef, endRef DtPolyRef,
	startPos, endPos []float32, filter *DtQueryFilter, options int32) DtStatus

/ @par / / @warning Calling any non-slice methods before calling finalizeSlicedFindPath() / or finalizeSlicedFindPathPartial() may result in corrupted data! / / The @p filter pointer is stored and used for the duration of the sliced / path query. /

func (*DtNavMeshQuery) IsInClosedList

func (q *DtNavMeshQuery) IsInClosedList(ref DtPolyRef) bool

/ @par / / The closed list is the list of polygons that were fully evaluated during / the last navigation graph search. (A* or Dijkstra) /

func (*DtNavMeshQuery) IsValidPolyRef

func (q *DtNavMeshQuery) IsValidPolyRef(ref DtPolyRef, filter *DtQueryFilter) bool

func (*DtNavMeshQuery) MoveAlongSurface

func (q *DtNavMeshQuery) MoveAlongSurface(startRef DtPolyRef, startPos, endPos []float32,
	filter *DtQueryFilter, resultPos []float32, visited []DtPolyRef, visitedCount *int32, maxVisitedSize int32) (status DtStatus)

/ @par / / This method is optimized for small delta movement and a small number of / polygons. If used for too great a distance, the result set will form an / incomplete path. / / @p resultPos will equal the @p endPos if the end is reached. / Otherwise the closest reachable position will be returned. / / @p resultPos is not projected onto the surface of the navigation / mesh. Use #getPolyHeight if this is needed. / / This method treats the end position in the same manner as / the #raycast method. (As a 2D point.) See that method's documentation / for details. / / If the @p visited array is too small to hold the entire result set, it will / be filled as far as possible from the start position toward the end / position. /

func (*DtNavMeshQuery) QueryPolygons

func (q *DtNavMeshQuery) QueryPolygons(center []float32, halfExtents []float32,
	filter *DtQueryFilter, query dtPolyQuery) DtStatus

/ @par / / The query will be invoked with batches of polygons. Polygons passed / to the query have bounding boxes that overlap with the center and halfExtents / passed to this function. The dtPolyQuery::process function is invoked multiple / times until all overlapping polygons have been processed. /

func (*DtNavMeshQuery) QueryPolygons1

func (q *DtNavMeshQuery) QueryPolygons1(center, halfExtents []float32,
	filter *DtQueryFilter,
	polys []DtPolyRef, maxPolys int32) (polyCount int32, status DtStatus)

/ @par / / If no polygons are found, the function will return #DT_SUCCESS with a / @p polyCount of zero. / / If @p polys is too small to hold the entire result set, then the array will / be filled to capacity. The method of choosing which polygons from the / full set are included in the partial result set is undefined. /

func (*DtNavMeshQuery) QueryPolygonsInTile

func (q *DtNavMeshQuery) QueryPolygonsInTile(tile *DtMeshTile, qmin, qmax []float32, filter *DtQueryFilter, query dtPolyQuery)

func (*DtNavMeshQuery) Raycast

func (q *DtNavMeshQuery) Raycast(startRef DtPolyRef, startPos, endPos []float32,
	filter *DtQueryFilter, t *float32, hitNormal []float32, path []DtPolyRef, pathCount *int32, maxPath int32) (status DtStatus)

/ @par / / This method is meant to be used for quick, short distance checks. / / If the path array is too small to hold the result, it will be filled as / far as possible from the start postion toward the end position. / / <b>Using the Hit Parameter (t)</b> / / If the hit parameter is a very high value (FLT_MAX), then the ray has hit / the end position. In this case the path represents a valid corridor to the / end position and the value of @p hitNormal is undefined. / / If the hit parameter is zero, then the start position is on the wall that / was hit and the value of @p hitNormal is undefined. / / If 0 < t < 1.0 then the following applies: / / @code / distanceToHitBorder = distanceToEndPosition * t / hitPoint = startPos + (endPos - startPos) * t / @endcode / / <b>Use Case Restriction</b> / / The raycast ignores the y-value of the end position. (2D check.) This / places significant limits on how it can be used. For example: / / Consider a scene where there is a main floor with a second floor balcony / that hangs over the main floor. So the first floor mesh extends below the / balcony mesh. The start position is somewhere on the first floor. The end / position is on the balcony. / / The raycast will search toward the end position along the first floor mesh. / If it reaches the end position's xz-coordinates it will indicate FLT_MAX / (no wall hit), meaning it reached the end position. This is one example of why / this method is meant for short distance checks. /

func (*DtNavMeshQuery) Raycast1

func (q *DtNavMeshQuery) Raycast1(startRef DtPolyRef, startPos, endPos []float32,
	filter *DtQueryFilter, options int32, hit *dtRaycastHit, prevRefs ...DtPolyRef) (status DtStatus)

/ @par / / This method is meant to be used for quick, short distance checks. / / If the path array is too small to hold the result, it will be filled as / far as possible from the start postion toward the end position. / / <b>Using the Hit Parameter t of RaycastHit</b> / / If the hit parameter is a very high value (FLT_MAX), then the ray has hit / the end position. In this case the path represents a valid corridor to the / end position and the value of @p hitNormal is undefined. / / If the hit parameter is zero, then the start position is on the wall that / was hit and the value of @p hitNormal is undefined. / / If 0 < t < 1.0 then the following applies: / / @code / distanceToHitBorder = distanceToEndPosition * t / hitPoint = startPos + (endPos - startPos) * t / @endcode / / <b>Use Case Restriction</b> / / The raycast ignores the y-value of the end position. (2D check.) This / places significant limits on how it can be used. For example: / / Consider a scene where there is a main floor with a second floor balcony / that hangs over the main floor. So the first floor mesh extends below the / balcony mesh. The start position is somewhere on the first floor. The end / position is on the balcony. / / The raycast will search toward the end position along the first floor mesh. / If it reaches the end position's xz-coordinates it will indicate FLT_MAX / (no wall hit), meaning it reached the end position. This is one example of why / this method is meant for short distance checks. /

func (*DtNavMeshQuery) UpdateSlicedFindPath

func (q *DtNavMeshQuery) UpdateSlicedFindPath(maxIter int32) (doneIters int32, status DtStatus)

type DtNode

type DtNode struct {
	Pos   []float32 ///< Position of the node.
	Cost  float32   ///< Cost from previous node to current node.
	Total float32   ///< Cost up to the node.
	Pidx  uint32    ///<  parent node.
	State uint32    ///< extra state information. A polyRef can have multiple nodes with different extra info. see DT_MAX_STATES_PER_NODE
	Flags uint32    ///< Node flags. A combination of DtNodeFlags.
	Id    DtPolyRef ///< Polygon ref the node corresponds to.
	// contains filtered or unexported fields
}

func NewDtNode

func NewDtNode() *DtNode

func (*DtNode) GetIndex

func (node *DtNode) GetIndex() int

func (*DtNode) SetIndex

func (node *DtNode) SetIndex(index int)

type DtNodeIndex

type DtNodeIndex int

type DtNodePool

type DtNodePool struct {
	// contains filtered or unexported fields
}

func NewDtNodePool

func NewDtNodePool(maxNodes, hashSize int32) *DtNodePool

func (*DtNodePool) Clear

func (p *DtNodePool) Clear()

func (*DtNodePool) FindNode1

func (p *DtNodePool) FindNode1(id DtPolyRef, state uint32) *DtNode

func (*DtNodePool) FindNodes

func (p *DtNodePool) FindNodes(id DtPolyRef, maxNodes int) (nodes []*DtNode, n int)

func (*DtNodePool) GetFirst

func (p *DtNodePool) GetFirst(bucket int) DtNodeIndex

func (*DtNodePool) GetHashSize

func (p *DtNodePool) GetHashSize() int32

func (*DtNodePool) GetMaxNodes

func (p *DtNodePool) GetMaxNodes() int32

func (*DtNodePool) GetNext

func (p *DtNodePool) GetNext(i int) DtNodeIndex

func (*DtNodePool) GetNode

func (p *DtNodePool) GetNode(id DtPolyRef, states ...uint32) *DtNode

func (*DtNodePool) GetNodeAtIdx

func (p *DtNodePool) GetNodeAtIdx(idx int) *DtNode

func (*DtNodePool) GetNodeCount

func (p *DtNodePool) GetNodeCount() int32

func (*DtNodePool) GetNodeIdx

func (p *DtNodePool) GetNodeIdx(node *DtNode) int

type DtOffMeshConnection

type DtOffMeshConnection struct {
	/// The endpoints of the connection. [(ax, ay, az, bx, by, bz)]
	Pos [6]float32

	/// The radius of the endpoints. [Limit: >= 0]
	Rad float32

	/// The polygon reference of the connection within the tile.
	Poly uint16

	/// Link flags.
	/// @note These are not the connection's user defined flags. Those are assigned via the
	/// connection's DtPoly definition. These are link flags used for internal purposes.
	Flags uint8

	/// End point side.
	Side uint8

	/// The id of the offmesh connection. (User assigned when the navigation mesh is built.)
	UserId uint32
}

/ Defines an navigation mesh off-mesh connection within a DtMeshTile object. / An off-mesh connection is a user defined traversable connection made up to two vertices.

func (*DtOffMeshConnection) FromBin

func (*DtOffMeshConnection) ToBin

func (d *DtOffMeshConnection) ToBin(w *rw.ReaderWriter)

type DtPoly

type DtPoly struct {
	/// Index to first link in linked list. (Or #DT_NULL_LINK if there is no link.)
	FirstLink uint32

	/// The indices of the polygon's vertices.
	/// The actual vertices are located in DtMeshTile::verts.
	Verts [DT_VERTS_PER_POLYGON]uint16

	/// Packed data representing neighbor polygons references and flags for each edge.
	Neis [DT_VERTS_PER_POLYGON]uint16

	/// The user defined polygon flags.
	Flags uint16

	/// The number of vertices in the polygon.
	VertCount uint8

	/// The bit packed area id and polygon type.
	/// @note Use the structure's set and get methods to access this value.
	AreaAndtype uint8
}

/ Defines a polygon within a DtMeshTile object. / @ingroup detour

func (*DtPoly) FromBin

func (d *DtPoly) FromBin(w *rw.ReaderWriter) *DtPoly

func (*DtPoly) GetArea

func (p *DtPoly) GetArea() uint8

/ Gets the user defined area id.

func (*DtPoly) GetType

func (p *DtPoly) GetType() uint8

/ Gets the polygon type. (See: #dtPolyTypes)

func (*DtPoly) SetArea

func (p *DtPoly) SetArea(a uint8)

/ Sets the user defined area id. [Limit: < #DT_MAX_AREAS]

func (*DtPoly) SetType

func (p *DtPoly) SetType(t uint8)

/ Sets the polygon type. (See: #dtPolyTypes.)

func (*DtPoly) ToBin

func (d *DtPoly) ToBin(w *rw.ReaderWriter)

type DtPolyDetail

type DtPolyDetail struct {
	VertBase  uint32 ///< The offset of the vertices in the DtMeshTile::detailVerts array.
	TriBase   uint32 ///< The offset of the triangles in the DtMeshTile::detailTris array.
	VertCount uint8  ///< The number of vertices in the sub-mesh.
	TriCount  uint8  ///< The number of triangles in the sub-mesh.
}

/ Defines the location of detail sub-mesh data within a DtMeshTile.

func (*DtPolyDetail) FromBin

func (d *DtPolyDetail) FromBin(w *rw.ReaderWriter) *DtPolyDetail

func (*DtPolyDetail) ToBin

func (d *DtPolyDetail) ToBin(w *rw.ReaderWriter)

type DtPolyRef

type DtPolyRef int

type DtQueryFilter

type DtQueryFilter struct {
	// contains filtered or unexported fields
}

func (*DtQueryFilter) GetAreaCost

func (filter *DtQueryFilter) GetAreaCost(i int) float32

/ Returns the traversal cost of the area. / @param[in] i The id of the area. / @returns The traversal cost of the area.

func (*DtQueryFilter) GetExcludeFlags

func (filter *DtQueryFilter) GetExcludeFlags() uint16

/ Returns the exclude flags for the filter. / Any polygons that include one ore more of these flags will be / excluded from the operation.

func (*DtQueryFilter) GetIncludeFlags

func (filter *DtQueryFilter) GetIncludeFlags() uint16

/ Returns the include flags for the filter. / Any polygons that include one or more of these flags will be / included in the operation.

func (*DtQueryFilter) SetAreaCost

func (filter *DtQueryFilter) SetAreaCost(i int, cost float32)

/ Sets the traversal cost of the area. / @param[in] i The id of the area. / @param[in] cost The new cost of traversing the area.

func (*DtQueryFilter) SetExcludeFlags

func (filter *DtQueryFilter) SetExcludeFlags(flags uint16)

/ Sets the exclude flags for the filter. / @param[in] flags The new flags.

func (*DtQueryFilter) SetIncludeFlags

func (filter *DtQueryFilter) SetIncludeFlags(flags uint16)

/ Sets the include flags for the filter. / @param[in] flags The new flags.

type DtStatus

type DtStatus int

func (DtStatus) DtStatusDetail

func (status DtStatus) DtStatusDetail(detail int) bool

Returns true if specific detail is set.

func (DtStatus) DtStatusFailed

func (status DtStatus) DtStatusFailed() bool

Returns true of status is failure.

func (DtStatus) DtStatusInProgress

func (status DtStatus) DtStatusInProgress() bool

Returns true of status is in progress.

func (DtStatus) DtStatusSucceed

func (status DtStatus) DtStatusSucceed() bool

Returns true of status is success.

type DtTileRef

type DtTileRef int

type IDtNavMesh

type IDtNavMesh interface {
	GetParams() *NavMeshParams
	/// Adds a tile to the navigation mesh.
	///  @param[in]		data		Data for the new tile mesh. (See: #dtCreateNavMeshData)
	///  @param[in]		dataSize	Data size of the new tile mesh.
	///  @param[in]		flags		Tile flags. (See: #dtTileFlags)
	///  @param[in]		lastRef		The desired reference for the tile. (When reloading a tile.) [opt] [Default: 0]
	///  @param[out]	result		The tile reference. (If the tile was succesfully added.) [opt]
	/// @return The status flags for the operation.
	AddTile(data *NavMeshData, flags int32, lastRef DtTileRef) (result DtTileRef, status DtStatus)
	/// Removes the specified tile from the navigation mesh.
	///  @param[in]		ref			The reference of the tile to remove.
	/// @return The status flags for the operation.
	RemoveTile(ref DtTileRef) (data *NavMeshData, status DtStatus)

	/// Calculates the tile grid location for the specified world position.
	///  @param[in]	pos  The world position for the query. [(x, y, z)]
	///  @param[out]	tx		The tile's x-location. (x, y)
	///  @param[out]	ty		The tile's y-location. (x, y)
	CalcTileLoc(pos []float32) (tx, ty int32)
	/// Gets the tile at the specified grid location.
	///  @param[in]	x		The tile's x-location. (x, y, layer)
	///  @param[in]	y		The tile's y-location. (x, y, layer)
	///  @param[in]	layer	The tile's layer. (x, y, layer)
	/// @return The tile, or null if the tile does not exist.
	GetTileAt(x, y, layer int32) *DtMeshTile
	/// Gets all tiles at the specified grid location. (All layers.)
	///  @param[in]		x			The tile's x-location. (x, y)
	///  @param[in]		y			The tile's y-location. (x, y)
	///  @param[out]	tiles		A pointer to an array of tiles that will hold the result.
	///  @param[in]		maxTiles	The maximum tiles the tiles parameter can hold.
	/// @return The number of tiles returned in the tiles array.
	GetTilesAt(x, y int32, maxTiles int32) ([]*DtMeshTile, int32)
	/// Gets the tile reference for the tile at specified grid location.
	///  @param[in]	x		The tile's x-location. (x, y, layer)
	///  @param[in]	y		The tile's y-location. (x, y, layer)
	///  @param[in]	layer	The tile's layer. (x, y, layer)
	/// @return The tile reference of the tile, or 0 if there is none.
	GetTileRefAt(x, y, layer int32) DtTileRef
	/// Gets the tile reference for the specified tile.
	///  @param[in]	tile	The tile.
	/// @return The tile reference of the tile.
	GetTileRef(tile *DtMeshTile) DtTileRef
	/// Gets the tile for the specified tile reference.
	///  @param[in]	ref		The tile reference of the tile to retrieve.
	/// @return The tile for the specified reference, or null if the
	///		reference is invalid.
	GetTileByRef(ref DtTileRef) *DtMeshTile
	/// The maximum number of tiles supported by the navigation mesh.
	/// @return The maximum number of tiles supported by the navigation mesh.
	GetMaxTiles() int32
	/// Gets the tile at the specified index.
	///  @param[in]	i		The tile index. [Limit: 0 >= index < #getMaxTiles()]
	/// @return The tile at the specified index.
	GetTile(i int) *DtMeshTile
	/// Gets the tile and polygon for the specified polygon reference.
	///  @param[in]		ref		The reference for the a polygon.
	///  @param[out]	tile	The tile containing the polygon.
	///  @param[out]	poly	The polygon.
	/// @return The status flags for the operation.
	GetTileAndPolyByRef(ref DtPolyRef) (tile *DtMeshTile, poly *DtPoly, status DtStatus)
	/// Returns the tile and polygon for the specified polygon reference.
	///  @param[in]		ref		A known valid reference for a polygon.
	///  @param[out]	tile	The tile containing the polygon.
	///  @param[out]	poly	The polygon.
	GetTileAndPolyByRefUnsafe(ref DtPolyRef) (tile *DtMeshTile, poly *DtPoly)
	/// Checks the validity of a polygon reference.
	///  @param[in]	ref		The polygon reference to check.
	/// @return True if polygon reference is valid for the navigation mesh.
	IsValidPolyRef(ref DtPolyRef) bool
	/// Gets the polygon reference for the tile's base polygon.
	///  @param[in]	tile		The tile.
	/// @return The polygon reference for the base polygon in the specified tile.
	GetPolyRefBase(tile *DtMeshTile) DtPolyRef
	/// Gets the endpoints for an off-mesh connection, ordered by "direction of travel".
	///  @param[in]		prevRef		The reference of the polygon before the connection.
	///  @param[in]		polyRef		The reference of the off-mesh connection polygon.
	///  @param[out]	startPos	The start position of the off-mesh connection. [(x, y, z)]
	///  @param[out]	endPos		The end position of the off-mesh connection. [(x, y, z)]
	/// @return The status flags for the operation.
	GetOffMeshConnectionPolyEndPoints(prevRef DtPolyRef, polyRef DtPolyRef, startPos []float32, endPos []float32) DtStatus
	/// Gets the specified off-mesh connection.
	///  @param[in]	ref		The polygon reference of the off-mesh connection.
	/// @return The specified off-mesh connection, or null if the polygon reference is not valid
	GetOffMeshConnectionByRef(ref DtPolyRef) *DtOffMeshConnection

	/// Sets the user defined flags for the specified polygon.
	///  @param[in]	ref		The polygon reference.
	///  @param[in]	flags	The new flags for the polygon.
	/// @return The status flags for the operation.
	SetPolyFlags(ref DtPolyRef, flags uint16) DtStatus

	/// Gets the user defined flags for the specified polygon.
	///  @param[in]		ref				The polygon reference.
	///  @param[out]	resultFlags		The polygon flags.
	/// @return The status flags for the operation.
	GetPolyFlags(ref DtPolyRef) (resultFlags uint16, status DtStatus)

	/// Sets the user defined area for the specified polygon.
	///  @param[in]	ref		The polygon reference.
	///  @param[in]	area	The new area id for the polygon. [Limit: < #DT_MAX_AREAS]
	/// @return The status flags for the operation.
	SetPolyArea(ref DtPolyRef, area uint8) DtStatus
	/// Gets the user defined area for the specified polygon.
	///  @param[in]		ref			The polygon reference.
	///  @param[out]	resultArea	The area id for the polygon.
	/// @return The status flags for the operation.
	GetPolyArea(ref DtPolyRef) (resultArea uint8, status DtStatus)

	/// Restores the state of the tile.
	///  @param[in]	tile			The tile.
	///  @param[in]	data			The new state. (Obtained from #storeTileState.)
	///  @param[in]	maxDataSize		The size of the state within the data buffer.
	/// @return The status flags for the operation.
	RestoreTileState(tile *DtMeshTile, tileState *dtTileState, polyStates []*dtPolyState, maxDataSize int32) DtStatus

	/// Derives a standard polygon reference.
	///  @note This function is generally meant for internal use only.
	///  @param[in]	salt	The tile's salt value.
	///  @param[in]	it		The index of the tile.
	///  @param[in]	ip		The index of the polygon within the tile.
	EncodePolyId(salt, it, ip uint32) DtPolyRef
	/// Decodes a standard polygon reference.
	///  @note This function is generally meant for internal use only.
	///  @param[in]	ref   The polygon reference to decode.
	///  @param[out]	salt	The tile's salt value.
	///  @param[out]	it		The index of the tile.
	///  @param[out]	ip		The index of the polygon within the tile.
	///  @see #encodePolyId
	DecodePolyId(ref DtPolyRef) (salt, it, ip uint32)
	/// Extracts a tile's salt value from the specified polygon reference.
	///  @note This function is generally meant for internal use only.
	///  @param[in]	ref		The polygon reference.
	///  @see #encodePolyId
	DecodePolyIdPoly(ref DtPolyRef) uint32
	/// Extracts the tile's index from the specified polygon reference.
	///  @note This function is generally meant for internal use only.
	///  @param[in]	ref		The polygon reference.
	///  @see #encodePolyId
	DecodePolyIdTile(ref DtPolyRef) uint32
	/// Extracts a tile's salt value from the specified polygon reference.
	///  @note This function is generally meant for internal use only.
	///  @param[in]	ref		The polygon reference.
	///  @see #encodePolyId
	DecodePolyIdSalt(ref DtPolyRef) uint32

	GetPolyHeight(tile *DtMeshTile, poly *DtPoly, pos []float32) (height float32, ok bool)
	ClosestPointOnPoly(ref DtPolyRef, pos []float32, closest []float32, posOverPoly *bool)
}
type NavMeshData struct {
	Header      *DtMeshHeader
	NavVerts    []float32
	NavPolys    []*DtPoly
	NavDMeshes  []*DtPolyDetail
	NavDVerts   []float32
	NavBvtree   []*DtBVNode
	NavDTris    []uint8
	OffMeshCons []*DtOffMeshConnection
	Links       []*DtLink // Ignore links; just leave enough space for them. They'll be created on load.// Ignore links; just leave enough space for them. They'll be created on load.
}

func DtCreateNavMeshData

func DtCreateNavMeshData(params *DtNavMeshCreateParams) (outData *NavMeshData, ok bool)

/ @par / / The output data array is allocated using the detour allocator (dtAlloc()). The method / used to free the memory will be determined by how the tile is added to the navigation / mesh. / / @see DtNavMesh, DtNavMesh::addTile()

func (d *NavMeshData) FromBin(r *rw.ReaderWriter) error
func (d *NavMeshData) FromProto()
func (d *NavMeshData) ToBin(w *rw.ReaderWriter) (dataSize int)
func (d *NavMeshData) ToProto()
type NavMeshParams struct {
	Orig       [3]float32 ///< The world space origin of the navigation mesh's tile space. [(x, y, z)]
	TileWidth  float32    ///< The width of each tile. (Along the x-axis.)
	TileHeight float32    ///< The height of each tile. (Along the z-axis.)
	MaxTiles   int32      ///< The maximum number of tiles the navigation mesh can contain. This and maxPolys are used to calculate how many bits are needed to identify tiles and polygons uniquely.
	MaxPolys   int32      ///< The maximum number of polygons each tile can contain. This and maxTiles are used to calculate how many bits are needed to identify tiles and polygons uniquely.
}

/ Configuration parameters used to define multi-tile navigation meshes. / The values are used to allocate space during the initialization of a navigation mesh. / @see DtNavMesh::init() / @ingroup detour

func (d *NavMeshParams) FromBin(r *rw.ReaderWriter)
func (d *NavMeshParams) ToBin(w *rw.ReaderWriter)
type NavMeshQuery interface {

	/// Finds a path from the start polygon to the end polygon.
	///  @param[in]		startRef	The reference id of the start polygon.
	///  @param[in]		endRef		The reference id of the end polygon.
	///  @param[in]		startPos	A position within the start polygon. [(x, y, z)]
	///  @param[in]		endPos		A position within the end polygon. [(x, y, z)]
	///  @param[in]		filter		The polygon filter to apply to the query.
	///  @param[out]	path		An ordered list of polygon references representing the path. (Start to end.)
	///  							[(polyRef) * @p pathCount]
	///  @param[out]	pathCount	The number of polygons returned in the @p path array.
	///  @param[in]		maxPath		The maximum number of polygons the @p path array can hold. [Limit: >= 1]
	FindPath(startRef, endRef DtPolyRef,
		startPos, endPos []float32, filter *DtQueryFilter, path []DtPolyRef, maxPath int32) (pathCount int32, status DtStatus)
	/// Finds the straight path from the start to the end position within the polygon corridor.
	///  @param[in]		startPos			Path start position. [(x, y, z)]
	///  @param[in]		endPos				Path end position. [(x, y, z)]
	///  @param[in]		path				An array of polygon references that represent the path corridor.
	///  @param[in]		pathSize			The number of polygons in the @p path array.
	///  @param[out]	straightPath		Points describing the straight path. [(x, y, z) * @p straightPathCount].
	///  @param[out]	straightPathFlags	Flags describing each point. (See: #dtStraightPathFlags) [opt]
	///  @param[out]	straightPathRefs	The reference id of the polygon that is being entered at each point. [opt]
	///  @param[out]	straightPathCount	The number of points in the straight path.
	///  @param[in]		maxStraightPath		The maximum number of points the straight path arrays can hold.  [Limit: > 0]
	///  @param[in]		options				Query options. (see: #dtStraightPathOptions)
	/// @returns The status flags for the query.
	FindStraightPath(startPos, endPos []float32,
		path []DtPolyRef, pathSize int32,
		straightPath []float32, straightPathFlags []int32, straightPathRefs []DtPolyRef,
		maxStraightPath int32, options ...int32) (straightPathCount int32, status DtStatus)
	/// Initializes a sliced path query.
	///  @param[in]		startRef	The reference id of the start polygon.
	///  @param[in]		endRef		The reference id of the end polygon.
	///  @param[in]		startPos	A position within the start polygon. [(x, y, z)]
	///  @param[in]		endPos		A position within the end polygon. [(x, y, z)]
	///  @param[in]		filter		The polygon filter to apply to the query.
	///  @param[in]		options		query options (see: #dtFindPathOptions)
	/// @returns The status flags for the query.
	InitSlicedFindPath(startRef, endRef DtPolyRef,
		startPos, endPos []float32, filter *DtQueryFilter, options int32) DtStatus
	/// Updates an in-progress sliced path query.
	///  @param[in]		maxIter		The maximum number of iterations to perform.
	///  @param[out]	doneIters	The actual number of iterations completed. [opt]
	/// @returns The status flags for the query.
	UpdateSlicedFindPath(maxIter int32) (doneIters int32, status DtStatus)
	/// Finalizes and returns the results of a sliced path query.
	///  @param[out]	path		An ordered list of polygon references representing the path. (Start to end.)
	///  							[(polyRef) * @p pathCount]
	///  @param[out]	pathCount	The number of polygons returned in the @p path array.
	///  @param[in]		maxPath		The max number of polygons the path array can hold. [Limit: >= 1]
	/// @returns The status flags for the query.
	FinalizeSlicedFindPath(path []DtPolyRef, maxPath int32) (pathCount int32, status DtStatus)
	/// 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.
	///  @param[in]		existing		An array of polygon references for the existing path.
	///  @param[in]		existingSize	The number of polygon in the @p existing array.
	///  @param[out]	path			An ordered list of polygon references representing the path. (Start to end.)
	///  								[(polyRef) * @p pathCount]
	///  @param[out]	pathCount		The number of polygons returned in the @p path array.
	///  @param[in]		maxPath			The max number of polygons the @p path array can hold. [Limit: >= 1]
	/// @returns The status flags for the query.
	FinalizeSlicedFindPathPartial(existing []DtPolyRef, existingSize int32,
		path []DtPolyRef, maxPath int32) (pathCount int32, status DtStatus)

	/// Finds the polygons along the navigation graph that touch the specified circle.
	///  @param[in]		startRef		The reference id of the polygon where the search starts.
	///  @param[in]		centerPos		The center of the search circle. [(x, y, z)]
	///  @param[in]		radius			The radius of the search circle.
	///  @param[in]		filter			The polygon filter to apply to the query.
	///  @param[out]	resultRef		The reference ids of the polygons touched by the circle. [opt]
	///  @param[out]	resultParent	The reference ids of the parent polygons for each result.
	///  								Zero if a result polygon has no parent. [opt]
	///  @param[out]	resultCost		The search cost from @p centerPos to the polygon. [opt]
	///  @param[out]	resultCount		The number of polygons found. [opt]
	///  @param[in]		maxResult		The maximum number of polygons the result arrays can hold.
	/// @returns The status flags for the query.
	FindPolysAroundCircle(startRef DtPolyRef, centerPos []float32, radius float32,
		filter *DtQueryFilter, resultRef []DtPolyRef, resultParent []DtPolyRef, resultCost []float32, resultCount *int32, maxResult int32) (status DtStatus)

	/// Finds the polygons along the naviation graph that touch the specified convex polygon.
	///  @param[in]		startRef		The reference id of the polygon where the search starts.
	///  @param[in]		verts			The vertices describing the convex polygon. (CCW)
	///  								[(x, y, z) * @p nverts]
	///  @param[in]		nverts			The number of vertices in the polygon.
	///  @param[in]		filter			The polygon filter to apply to the query.
	///  @param[out]	resultRef		The reference ids of the polygons touched by the search polygon. [opt]
	///  @param[out]	resultParent	The reference ids of the parent polygons for each result. Zero if a
	///  								result polygon has no parent. [opt]
	///  @param[out]	resultCost		The search cost from the centroid point to the polygon. [opt]
	///  @param[out]	resultCount		The number of polygons found.
	///  @param[in]		maxResult		The maximum number of polygons the result arrays can hold.
	/// @returns The status flags for the query.
	FindPolysAroundShape(startRef DtPolyRef, verts []float32, nverts int32,
		filter *DtQueryFilter,
		resultRef []DtPolyRef, resultParent []DtPolyRef, resultCost []float32, maxResult int32) (resultCount int32, status DtStatus)
	/// Gets a path from the explored nodes in the previous search.
	///  @param[in]		endRef		The reference id of the end polygon.
	///  @param[out]	path		An ordered list of polygon references representing the path. (Start to end.)
	///  							[(polyRef) * @p pathCount]
	///  @param[out]	pathCount	The number of polygons returned in the @p path array.
	///  @param[in]		maxPath		The maximum number of polygons the @p path array can hold. [Limit: >= 0]
	///  @returns		The status flags. Returns DT_FAILURE | DT_INVALID_PARAM if any parameter is wrong, or if
	///  				@p endRef was not explored in the previous search. Returns DT_SUCCESS | DT_BUFFER_TOO_SMALL
	///  				if @p path cannot contain the entire path. In this case it is filled to capacity with a partial path.
	///  				Otherwise returns DT_SUCCESS.
	///  @remarks		The result of this function depends on the state of the query object. For that reason it should only
	///  				be used immediately after one of the two Dijkstra searches, findPolysAroundCircle or findPolysAroundShape.
	GetPathFromDijkstraSearch(endRef DtPolyRef, path []DtPolyRef, maxPath int32) (pathCount int32, status DtStatus)
	/// Finds polygons that overlap the search box.
	///  @param[in]		center		The center of the search box. [(x, y, z)]
	///  @param[in]		halfExtents		The search distance along each axis. [(x, y, z)]
	///  @param[in]		filter		The polygon filter to apply to the query.
	///  @param[in]		query		The query. Polygons found will be batched together and passed to this query.
	QueryPolygons(center []float32, halfExtents []float32,
		filter *DtQueryFilter, query dtPolyQuery) DtStatus
	/// Finds polygons that overlap the search box.
	///  @param[in]		center		The center of the search box. [(x, y, z)]
	///  @param[in]		halfExtents		The search distance along each axis. [(x, y, z)]
	///  @param[in]		filter		The polygon filter to apply to the query.
	///  @param[out]	polys		The reference ids of the polygons that overlap the query box.
	///  @param[out]	polyCount	The number of polygons in the search result.
	///  @param[in]		maxPolys	The maximum number of polygons the search result can hold.
	/// @returns The status flags for the query.
	QueryPolygons1(center, halfExtents []float32,
		filter *DtQueryFilter,
		polys []DtPolyRef, maxPolys int32) (polyCount int32, status DtStatus)
	/// Finds the non-overlapping navigation polygons in the local neighbourhood around the center position.
	///  @param[in]		startRef		The reference id of the polygon where the search starts.
	///  @param[in]		centerPos		The center of the query circle. [(x, y, z)]
	///  @param[in]		radius			The radius of the query circle.
	///  @param[in]		filter			The polygon filter to apply to the query.
	///  @param[out]	resultRef		The reference ids of the polygons touched by the circle.
	///  @param[out]	resultParent	The reference ids of the parent polygons for each result.
	///  								Zero if a result polygon has no parent. [opt]
	///  @param[out]	resultCount		The number of polygons found.
	///  @param[in]		maxResult		The maximum number of polygons the result arrays can hold.
	/// @returns The status flags for the query.
	FindLocalNeighbourhood(startRef DtPolyRef, centerPos []float32, radius float32,
		filter *DtQueryFilter,
		resultRef []DtPolyRef, resultParent []DtPolyRef, maxResult int32) (resultCount int32, status DtStatus)
	/// Moves from the start to the end position constrained to the navigation mesh.
	///  @param[in]		startRef		The reference id of the start polygon.
	///  @param[in]		startPos		A position of the mover within the start polygon. [(x, y, x)]
	///  @param[in]		endPos			The desired end position of the mover. [(x, y, z)]
	///  @param[in]		filter			The polygon filter to apply to the query.
	///  @param[out]	resultPos		The result position of the mover. [(x, y, z)]
	///  @param[out]	visited			The reference ids of the polygons visited during the move.
	///  @param[out]	visitedCount	The number of polygons visited during the move.
	///  @param[in]		maxVisitedSize	The maximum number of polygons the @p visited array can hold.
	/// @returns The status flags for the query.
	MoveAlongSurface(startRef DtPolyRef, startPos, endPos []float32,
		filter *DtQueryFilter, resultPos []float32, visited []DtPolyRef, visitedCount *int32, maxVisitedSize int32) (status DtStatus)

	/// Finds the polygon nearest to the specified center point.
	/// [opt] means the specified parameter can be a null pointer, in that case the output parameter will not be set.
	///
	///  @param[in]		center		The center of the search box. [(x, y, z)]
	///  @param[in]		halfExtents	The search distance along each axis. [(x, y, z)]
	///  @param[in]		filter		The polygon filter to apply to the query.
	///  @param[out]	nearestRef	The reference id of the nearest polygon. Will be set to 0 if no polygon is found.
	///  @param[out]	nearestPt	The nearest point on the polygon. Unchanged if no polygon is found. [opt] [(x, y, z)]
	///  @param[out]	isOverPoly 	Set to true if the point's X/Z coordinate lies inside the polygon, false otherwise. Unchanged if no polygon is found. [opt]
	/// @returns The status flags for the query.
	FindNearestPoly1(center, halfExtents []float32,
		filter *DtQueryFilter, nearestPt []float32) (nearestRef DtPolyRef, isOverPoly bool, status DtStatus)

	/// Finds the polygon nearest to the specified center point.
	/// [opt] means the specified parameter can be a null pointer, in that case the output parameter will not be set.
	///
	///  @param[in]		center		The center of the search box. [(x, y, z)]
	///  @param[in]		halfExtents	The search distance along each axis. [(x, y, z)]
	///  @param[in]		filter		The polygon filter to apply to the query.
	///  @param[out]	nearestRef	The reference id of the nearest polygon. Will be set to 0 if no polygon is found.
	///  @param[out]	nearestPt	The nearest point on the polygon. Unchanged if no polygon is found. [opt] [(x, y, z)]
	/// @returns The status flags for the query.
	FindNearestPoly(center, halfExtents []float32, filter *DtQueryFilter, nearestPt []float32) (nearestRef DtPolyRef, status DtStatus)
	/// Casts a 'walkability' ray along the surface of the navigation mesh from
	/// the start position toward the end position.
	/// @note A wrapper around raycast(..., RaycastHit*). Retained for backward compatibility.
	///  @param[in]		startRef	The reference id of the start polygon.
	///  @param[in]		startPos	A position within the start polygon representing
	///  							the start of the ray. [(x, y, z)]
	///  @param[in]		endPos		The position to cast the ray toward. [(x, y, z)]
	///  @param[in]		filter		The polygon filter to apply to the query.
	///  @param[out]	t			The hit parameter. (FLT_MAX if no wall hit.)
	///  @param[out]	hitNormal	The normal of the nearest wall hit. [(x, y, z)]
	///  @param[out]	path		The reference ids of the visited polygons. [opt]
	///  @param[out]	pathCount	The number of visited polygons. [opt]
	///  @param[in]		maxPath		The maximum number of polygons the @p path array can hold.
	/// @returns The status flags for the query.
	Raycast(startRef DtPolyRef, startPos, endPos []float32,
		filter *DtQueryFilter, t *float32, hitNormal []float32, path []DtPolyRef, pathCount *int32, maxPath int32) (status DtStatus)

	/// Casts a 'walkability' ray along the surface of the navigation mesh from
	/// the start position toward the end position.
	///  @param[in]		startRef	The reference id of the start polygon.
	///  @param[in]		startPos	A position within the start polygon representing
	///  							the start of the ray. [(x, y, z)]
	///  @param[in]		endPos		The position to cast the ray toward. [(x, y, z)]
	///  @param[in]		filter		The polygon filter to apply to the query.
	///  @param[in]		options		govern how the raycast behaves. See dtRaycastOptions
	///  @param[out]	hit			Pointer to a raycast hit structure which will be filled by the results.
	///  @param[in]		prevRef		parent of start ref. Used during for cost calculation [opt]
	/// @returns The status flags for the query.
	Raycast1(startRef DtPolyRef, startPos, endPos []float32,
		filter *DtQueryFilter, options int32, hit *dtRaycastHit, prevRef ...DtPolyRef) (status DtStatus)
	/// Finds the distance from the specified position to the nearest polygon wall.
	///  @param[in]		startRef		The reference id of the polygon containing @p centerPos.
	///  @param[in]		centerPos		The center of the search circle. [(x, y, z)]
	///  @param[in]		maxRadius		The radius of the search circle.
	///  @param[in]		filter			The polygon filter to apply to the query.
	///  @param[out]	hitDist			The distance to the nearest wall from @p centerPos.
	///  @param[out]	hitPos			The nearest position on the wall that was hit. [(x, y, z)]
	///  @param[out]	hitNormal		The normalized ray formed from the wall point to the
	///  								source point. [(x, y, z)]
	/// @returns The status flags for the query.
	FindDistanceToWall(startRef DtPolyRef, centerPos []float32, maxRadius float32,
		filter *DtQueryFilter, hitDist *float32, hitPos []float32, hitNormal []float32) (status DtStatus)
	/// Returns random location on navmesh.
	/// Polygons are chosen weighted by area. The search runs in linear related to number of polygon.
	///  @param[in]		filter			The polygon filter to apply to the query.
	///  @param[in]		frand			Function returning a random number [0..1).
	///  @param[out]	randomRef		The reference id of the random location.
	///  @param[out]	randomPt		The random location.
	/// @returns The status flags for the query.
	FindRandomPoint(filter *DtQueryFilter) (randomRef DtPolyRef, randomPt []float32, status DtStatus)
	/// Returns the segments for the specified polygon, optionally including portals.
	///  @param[in]		ref				The reference id of the polygon.
	///  @param[in]		filter			The polygon filter to apply to the query.
	///  @param[out]	segmentVerts	The segments. [(ax, ay, az, bx, by, bz) * segmentCount]
	///  @param[out]	segmentRefs		The reference ids of each segment's neighbor polygon.
	///  								Or zero if the segment is a wall. [opt] [(parentRef) * @p segmentCount]
	///  @param[out]	segmentCount	The number of segments returned.
	///  @param[in]		maxSegments		The maximum number of segments the result arrays can hold.
	/// @returns The status flags for the query.
	GetPolyWallSegments(ref DtPolyRef, filter *DtQueryFilter,
		segmentVerts []float32, segmentRefs []DtPolyRef,
		maxSegments int32) (segmentCount int32, status DtStatus)

	/// Returns random location on navmesh within the reach of specified location.
	/// Polygons are chosen weighted by area. The search runs in linear related to number of polygon.
	/// The location is not exactly constrained by the circle, but it limits the visited polygons.
	///  @param[in]		startRef		The reference id of the polygon where the search starts.
	///  @param[in]		centerPos		The center of the search circle. [(x, y, z)]
	///  @param[in]		maxRadius		The radius of the search circle. [Units: wu]
	///  @param[in]		filter			The polygon filter to apply to the query.
	///  @param[in]		frand			Function returning a random number [0..1).
	///  @param[out]	randomRef		The reference id of the random location.
	///  @param[out]	randomPt		The random location. [(x, y, z)]
	/// @returns The status flags for the query.
	FindRandomPointAroundCircle(startRef DtPolyRef, centerPos []float32, maxRadius float32,
		filter *DtQueryFilter) (randomRef DtPolyRef, randomPt []float32, status DtStatus)
	/// Finds the closest point on the specified polygon.
	///  @param[in]		ref			The reference id of the polygon.
	///  @param[in]		pos			The position to check. [(x, y, z)]
	///  @param[out]	closest		The closest point on the polygon. [(x, y, z)]
	///  @param[out]	posOverPoly	True of the position is over the polygon.
	/// @returns The status flags for the query.
	ClosestPointOnPoly(ref DtPolyRef, pos []float32, closest []float32, posOverPoly *bool) (status DtStatus)
	/// Returns a point on the boundary closest to the source point if the source point is outside the
	/// polygon's xz-bounds.
	///  @param[in]		ref			The reference id to the polygon.
	///  @param[in]		pos			The position to check. [(x, y, z)]
	///  @param[out]	closest		The closest point. [(x, y, z)]
	/// @returns The status flags for the query.
	ClosestPointOnPolyBoundary(ref DtPolyRef, pos []float32) (closest []float32, status DtStatus)

	/// Gets the height of the polygon at the provided position using the height detail. (Most accurate.)
	///  @param[in]		ref			The reference id of the polygon.
	///  @param[in]		pos			A position within the xz-bounds of the polygon. [(x, y, z)]
	///  @param[out]	height		The height at the surface of the polygon.
	/// @returns The status flags for the query.
	GetPolyHeight(ref DtPolyRef, pos []float32) (height float32, status DtStatus)

	/// Returns true if the polygon reference is valid and passes the filter restrictions.
	///  @param[in]		ref			The polygon reference to check.
	///  @param[in]		filter		The filter to apply.
	IsValidPolyRef(ref DtPolyRef, filter *DtQueryFilter) bool
	/// Returns true if the polygon reference is in the closed list.
	///  @param[in]		ref		The reference id of the polygon to check.
	/// @returns True if the polygon is in closed list.
	IsInClosedList(ref DtPolyRef) bool

	GetAttachedNavMesh() IDtNavMesh

	GetNodePool() *DtNodePool
}

func NewDtNavMeshQuery

func NewDtNavMeshQuery(nav IDtNavMesh, maxNodes int32) NavMeshQuery

/ Initializes the query object. / @param[in] nav Pointer to the DtNavMesh object to use for all queries. / @param[in] maxNodes Maximum number of search nodes. [Limits: 0 < value <= 65535] / @returns The status flags for the query.

type NodeQueue

type NodeQueue[T any] interface {
	Peek() T         //查看堆顶,不会移除元素
	Poll() T         //从堆顶弹出一个元素
	Update(any) bool //更新元素
	Remove(any) bool //移除一个元素
	Offer(T)         //插入一个元素
	Reset()
	Empty() bool
}

func NewNodeQueue

func NewNodeQueue[T any](less func(t1, t2 T) bool) NodeQueue[T]

type NodeQueueIndex

type NodeQueueIndex interface {
	SetIndex(index int)
	GetIndex() int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL