Documentation ¶
Index ¶
- Constants
- Variables
- func DtAbsFloat32(a float32) float32
- func DtAbsInt16(a int16) int16
- func DtAbsInt32(a int32) int32
- func DtAlign4(x int) int
- func DtAssert(expression bool)
- func DtAssertFailSetCustom(assertFailFunc DtAssertFailFunc)
- func DtCalcPolyCenter(tc []float32, idx []uint16, nidx int, verts []float32)
- func DtClampFloat32(v, mn, mx float32) float32
- func DtClampInt16(v, mn, mx int16) int16
- func DtClampInt32(v, mn, mx int32) int32
- func DtClampUInt16(v, mn, mx uint16) uint16
- func DtClampUInt32(v, mn, mx uint32) uint32
- func DtClosestHeightPointTriangle(p, a, b, c []float32, h *float32) bool
- func DtClosestPtPointTriangle(closest, p, a, b, c []float32)
- func DtCreateNavMeshData(params *DtNavMeshCreateParams, outData *[]byte, outDataSize *int) bool
- func DtDistancePtPolyEdgesSqr(pt, verts []float32, nverts int, ed, et []float32) bool
- func DtDistancePtSegSqr2D(pt, p, q []float32, t *float32) float32
- func DtFreeDtQueryFilter(filter *DtQueryFilter)
- func DtFreeNavMesh(navmesh *DtNavMesh)
- func DtFreeNavMeshQuery(query *DtNavMeshQuery)
- func DtFreeNodePool(pool *DtNodePool)
- func DtFreeNodeQueue(queue *DtNodeQueue)
- func DtHashRef(polyRef DtPolyRef) uint32
- func DtIgnoreUnused(interface{})
- func DtIlog2(v uint32) uint32
- func DtIntersectSegSeg2D(ap, aq, bp, bq []float32, s, t *float32) bool
- func DtIntersectSegmentPoly2D(p0, p1, verts []float32, nverts int, tmin, tmax *float32, segMin, segMax *int) bool
- func DtMathAtan2f(y float32, x float32) float32
- func DtMathCeilf(x float32) float32
- func DtMathCosf(x float32) float32
- func DtMathFabsf(x float32) float32
- func DtMathFloorf(x float32) float32
- func DtMathSinf(x float32) float32
- func DtMathSqrtf(x float32) float32
- func DtMaxFloat32(a, b float32) float32
- func DtMaxInt16(a, b int16) int16
- func DtMaxInt32(a, b int32) int32
- func DtMaxInt8(a, b int8) int8
- func DtMaxUInt16(a, b uint16) uint16
- func DtMaxUInt32(a, b uint32) uint32
- func DtMaxUInt8(a, b uint8) uint8
- func DtMinFloat32(a, b float32) float32
- func DtMinInt16(a, b int16) int16
- func DtMinInt32(a, b int32) int32
- func DtMinUInt16(a, b uint16) uint16
- func DtMinUInt32(a, b uint32) uint32
- func DtNavMeshDataSwapEndian(data []byte, _ int) bool
- func DtNavMeshHeaderSwapEndian(data []byte, _ int) bool
- func DtNextPow2(v uint32) uint32
- func DtOppositeTile(side int) int
- func DtOverlapBounds(amin, amax, bmin, bmax []float32) bool
- func DtOverlapPolyPoly2D(polya []float32, npolya int, polyb []float32, npolyb int) bool
- func DtOverlapQuantBounds(amin, amax, bmin, bmax []uint16) bool
- func DtPointInPolygon(pt, verts []float32, nverts int) bool
- func DtRandomPointInConvexPoly(pts []float32, npts int, areas []float32, s, t float32, out []float32)
- func DtSqrFloat32(a float32) float32
- func DtSqrInt16(a int16) int16
- func DtSqrInt32(a int32) int32
- func DtSqrUInt16(a uint16) uint16
- func DtSqrUInt32(a uint32) uint32
- func DtStatusDetail(status DtStatus, detail DtStatus) bool
- func DtStatusFailed(status DtStatus) bool
- func DtStatusInProgress(status DtStatus) bool
- func DtStatusSucceed(status DtStatus) bool
- func DtSwapByte(a, b *uint8)
- func DtSwapEndianFloat32(v *float32)
- func DtSwapEndianInt16(v *int16)
- func DtSwapEndianInt32(v *int32)
- func DtSwapEndianUInt16(v *uint16)
- func DtSwapEndianUInt32(v *uint32)
- func DtSwapFloat32(a, b *float32)
- func DtSwapInt16(a, b *int16)
- func DtSwapInt32(a, b *int32)
- func DtSwapUInt16(a, b *uint16)
- func DtSwapUInt32(a, b *uint32)
- func DtTriArea2D(a, b, c []float32) float32
- func DtVadd(dest, v1, v2 []float32)
- func DtVcopy(dest, a []float32)
- func DtVcross(dest, v1, v2 []float32)
- func DtVdist(v1, v2 []float32) float32
- func DtVdist2D(v1, v2 []float32) float32
- func DtVdist2DSqr(v1, v2 []float32) float32
- func DtVdistSqr(v1, v2 []float32) float32
- func DtVdot(v1, v2 []float32) float32
- func DtVdot2D(u, v []float32) float32
- func DtVequal(p0, p1 []float32) bool
- func DtVlen(v []float32) float32
- func DtVlenSqr(v []float32) float32
- func DtVlerp(dest, v1, v2 []float32, t float32)
- func DtVmad(dest, v1, v2 []float32, s float32)
- func DtVmax(mx, v []float32)
- func DtVmin(mn, v []float32)
- func DtVnormalize(v []float32)
- func DtVperp2D(u, v []float32) float32
- func DtVscale(dest, v []float32, t float32)
- func DtVset(dest []float32, x, y, z float32)
- func DtVsub(dest, v1, v2 []float32)
- func Memset(mem uintptr, val uint8, size int)
- func SliceSizeFromPointer(p, start unsafe.Pointer, eleSize uintptr) uint32
- type BVItem
- type DtAssertFailFunc
- type DtBVNode
- type DtFindPathOptions
- type DtLink
- type DtMeshHeader
- type DtMeshTile
- type DtNavMesh
- func (this *DtNavMesh) AddTile(data []byte, dataSize int, flags DtTileFlags, lastRef DtTileRef, ...) DtStatus
- func (this *DtNavMesh) CalcTileLoc(pos []float32, tx, ty *int32)
- func (this *DtNavMesh) DecodePolyId(ref DtPolyRef, salt, it, ip *uint32)
- func (this *DtNavMesh) DecodePolyIdPoly(ref DtPolyRef) uint32
- func (this *DtNavMesh) DecodePolyIdSalt(ref DtPolyRef) uint32
- func (this *DtNavMesh) DecodePolyIdTile(ref DtPolyRef) uint32
- func (this *DtNavMesh) EncodePolyId(salt, it, ip uint32) DtPolyRef
- func (this *DtNavMesh) GetMaxTiles() int32
- func (this *DtNavMesh) GetNeighbourTilesAt(x, y int32, side int, tiles []*DtMeshTile, maxTiles int) int
- func (this *DtNavMesh) GetOffMeshConnectionByRef(ref DtPolyRef) *DtOffMeshConnection
- func (this *DtNavMesh) GetOffMeshConnectionPolyEndPoints(prevRef, polyRef DtPolyRef, startPos, endPos []float32) DtStatus
- func (this *DtNavMesh) GetParams() *DtNavMeshParams
- func (this *DtNavMesh) GetPolyArea(ref DtPolyRef, resultArea *uint8) DtStatus
- func (this *DtNavMesh) GetPolyFlags(ref DtPolyRef, resultFlags *uint16) DtStatus
- func (this *DtNavMesh) GetPolyRefBase(tile *DtMeshTile) DtPolyRef
- func (this *DtNavMesh) GetTile(i int) *DtMeshTile
- func (this *DtNavMesh) GetTileAndPolyByRef(ref DtPolyRef, tile **DtMeshTile, poly **DtPoly) DtStatus
- func (this *DtNavMesh) GetTileAndPolyByRefUnsafe(ref DtPolyRef, tile **DtMeshTile, poly **DtPoly)
- func (this *DtNavMesh) GetTileAt(x, y, layer int32) *DtMeshTile
- func (this *DtNavMesh) GetTileByRef(ref DtTileRef) *DtMeshTile
- func (this *DtNavMesh) GetTileRef(tile *DtMeshTile) DtTileRef
- func (this *DtNavMesh) GetTileRefAt(x, y, layer int32) DtTileRef
- func (this *DtNavMesh) GetTileStateSize(tile *DtMeshTile) int
- func (this *DtNavMesh) GetTilesAt(x, y int32, tiles []*DtMeshTile, maxTiles int) int
- func (this *DtNavMesh) Init(params *DtNavMeshParams) DtStatus
- func (this *DtNavMesh) Init2(data []byte, dataSize int, flags DtTileFlags) DtStatus
- func (this *DtNavMesh) IsValidPolyRef(ref DtPolyRef) bool
- func (this *DtNavMesh) RemoveTile(ref DtTileRef, data *[]byte, dataSize *int) DtStatus
- func (this *DtNavMesh) RestoreTileState(tile *DtMeshTile, data []byte, maxDataSize int) DtStatus
- func (this *DtNavMesh) SetPolyArea(ref DtPolyRef, area uint8) DtStatus
- func (this *DtNavMesh) SetPolyFlags(ref DtPolyRef, flags uint16) DtStatus
- func (this *DtNavMesh) StoreTileState(tile *DtMeshTile, data []byte, maxDataSize int) DtStatus
- type DtNavMeshCreateParams
- type DtNavMeshParams
- type DtNavMeshQuery
- func (this *DtNavMeshQuery) ClosestPointOnPoly(ref DtPolyRef, pos, closest []float32, posOverPoly *bool) DtStatus
- func (this *DtNavMeshQuery) ClosestPointOnPolyBoundary(ref DtPolyRef, pos, closest []float32) DtStatus
- func (this *DtNavMeshQuery) FinalizeSlicedFindPath(path []DtPolyRef, pathCount *int, maxPath int) DtStatus
- func (this *DtNavMeshQuery) FinalizeSlicedFindPathPartial(existing []DtPolyRef, existingSize int, path []DtPolyRef, pathCount *int, ...) DtStatus
- func (this *DtNavMeshQuery) FindDistanceToWall(startRef DtPolyRef, centerPos []float32, maxRadius float32, ...) DtStatus
- func (this *DtNavMeshQuery) FindLocalNeighbourhood(startRef DtPolyRef, centerPos []float32, radius float32, filter *DtQueryFilter, ...) DtStatus
- func (this *DtNavMeshQuery) FindNearestPoly(center, halfExtents []float32, filter *DtQueryFilter, nearestRef *DtPolyRef, ...) DtStatus
- func (this *DtNavMeshQuery) FindPath(startRef, endRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, ...) DtStatus
- func (this *DtNavMeshQuery) FindPolysAroundCircle(startRef DtPolyRef, centerPos []float32, radius float32, filter *DtQueryFilter, ...) DtStatus
- func (this *DtNavMeshQuery) FindPolysAroundShape(startRef DtPolyRef, verts []float32, nverts int, filter *DtQueryFilter, ...) DtStatus
- func (this *DtNavMeshQuery) FindRandomPoint(filter *DtQueryFilter, frand func() float32, randomRef *DtPolyRef, ...) DtStatus
- func (this *DtNavMeshQuery) FindRandomPointAroundCircle(startRef DtPolyRef, centerPos []float32, maxRadius float32, ...) DtStatus
- func (this *DtNavMeshQuery) FindStraightPath(startPos, endPos []float32, path []DtPolyRef, pathSize int, ...) DtStatus
- func (this *DtNavMeshQuery) GetAttachedNavMesh() *DtNavMesh
- func (this *DtNavMeshQuery) GetNodePool() *DtNodePool
- func (this *DtNavMeshQuery) GetPathFromDijkstraSearch(endRef DtPolyRef, path []DtPolyRef, pathCount *int, maxPath int) DtStatus
- func (this *DtNavMeshQuery) GetPolyHeight(ref DtPolyRef, pos []float32, height *float32) DtStatus
- func (this *DtNavMeshQuery) GetPolyWallSegments(ref DtPolyRef, filter *DtQueryFilter, segmentVerts []float32, ...) DtStatus
- func (this *DtNavMeshQuery) Init(nav *DtNavMesh, maxNodes int) DtStatus
- func (this *DtNavMeshQuery) InitSlicedFindPath(startRef, endRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, ...) DtStatus
- func (this *DtNavMeshQuery) IsInClosedList(ref DtPolyRef) bool
- func (this *DtNavMeshQuery) IsValidPolyRef(ref DtPolyRef, filter *DtQueryFilter) bool
- func (this *DtNavMeshQuery) MoveAlongSurface(startRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, ...) DtStatus
- func (this *DtNavMeshQuery) QueryPolygons(center, halfExtents []float32, filter *DtQueryFilter, polys []DtPolyRef, ...) DtStatus
- func (this *DtNavMeshQuery) QueryPolygons2(center, halfExtents []float32, filter *DtQueryFilter, query DtPolyQuery) DtStatus
- func (this *DtNavMeshQuery) Raycast(startRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, ...) DtStatus
- func (this *DtNavMeshQuery) Raycast2(startRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, ...) DtStatus
- func (this *DtNavMeshQuery) UpdateSlicedFindPath(maxIter int, doneIters *int) DtStatus
- type DtNode
- type DtNodeFlags
- type DtNodeIndex
- type DtNodePool
- func (this *DtNodePool) Clear()
- func (this *DtNodePool) FindNode(id DtPolyRef, state uint8) *DtNode
- func (this *DtNodePool) FindNodes(id DtPolyRef, nodes []*DtNode, maxNodes uint32) uint32
- func (this *DtNodePool) GetFirst(bucket int) DtNodeIndex
- func (this *DtNodePool) GetHashSize() uint32
- func (this *DtNodePool) GetMaxNodes() uint32
- func (this *DtNodePool) GetMemUsed() uint32
- func (this *DtNodePool) GetNext(i int) DtNodeIndex
- func (this *DtNodePool) GetNode(id DtPolyRef, state uint8) *DtNode
- func (this *DtNodePool) GetNodeAtIdx(idx uint32) *DtNode
- func (this *DtNodePool) GetNodeCount() uint32
- func (this *DtNodePool) GetNodeIdx(node *DtNode) uint32
- type DtNodeQueue
- func (this *DtNodeQueue) Clear()
- func (this *DtNodeQueue) Empty() bool
- func (this *DtNodeQueue) GetCapacity() int
- func (this *DtNodeQueue) GetMemUsed() uint32
- func (this *DtNodeQueue) Modify(node *DtNode)
- func (this *DtNodeQueue) Pop() *DtNode
- func (this *DtNodeQueue) Push(node *DtNode)
- func (this *DtNodeQueue) Top() *DtNode
- type DtOffMeshConnection
- type DtPoly
- type DtPolyDetail
- type DtPolyQuery
- type DtPolyRef
- type DtPolyTypes
- type DtQueryFilter
- func (this *DtQueryFilter) GetAreaCost(i int) float32
- func (this *DtQueryFilter) GetCost(pa, pb []float32, _ DtPolyRef, _ *DtMeshTile, _ *DtPoly, _ DtPolyRef, ...) float32
- func (this *DtQueryFilter) GetExcludeFlags() uint16
- func (this *DtQueryFilter) GetIncludeFlags() uint16
- func (this *DtQueryFilter) PassFilter(_ DtPolyRef, _ *DtMeshTile, poly *DtPoly) bool
- func (this *DtQueryFilter) SetAreaCost(i int, cost float32)
- func (this *DtQueryFilter) SetExcludeFlags(flags uint16)
- func (this *DtQueryFilter) SetIncludeFlags(flags uint16)
- type DtRaycastHit
- type DtRaycastOptions
- type DtStatus
- type DtStraightPathFlags
- type DtStraightPathOptions
- type DtTileFlags
- type DtTileRef
Constants ¶
const DT_EXT_LINK uint16 = 0x8000
/ 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.)
const DT_MAX_AREAS int = 64
/ The maximum number of user defined area ids. / @ingroup detour
const DT_MAX_STATES_PER_NODE int = 1 << DT_NODE_STATE_BITS // number of extra states per node. See dtNode::state
const DT_NAVMESH_MAGIC int32 = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V'
/ A magic number used to detect compatibility of navigation tile data.
const DT_NAVMESH_STATE_MAGIC int32 = 'D'<<24 | 'N'<<16 | 'M'<<8 | 'S'
/ A magic number used to detect the compatibility of navigation tile states.
const DT_NAVMESH_STATE_VERSION int32 = 1
/ A version number used to detect compatibility of navigation tile states.
const DT_NAVMESH_VERSION int32 = 7
/ A version number used to detect compatibility of navigation tile data.
const DT_NODE_FLAGS_BITS uint32 = 3
const DT_NODE_PARENT_BITS uint32 = 24
const DT_NODE_STATE_BITS uint32 = 2
const DT_NULL_LINK uint32 = 0xffffffff
/ A value that indicates the entity does not link to anything.
const DT_OFFMESH_CON_BIDIR uint8 = 1
/ A flag that indicates that an off-mesh connection can be traversed in both directions. (Is bidirectional.)
const DT_RAY_CAST_LIMIT_PROPORTIONS float32 = 50.0
/ Limit raycasting during any angle pahfinding / The limit is given as a multiple of the character radius
const DT_VERTS_PER_POLYGON int32 = 6
/ The maximum number of vertices per navigation polygon. / @ingroup detour
const H_SCALE float32 = 0.999 // Search heuristic scale.
Variables ¶
var EPS float32 = 1e-4
var MESH_NULL_IDX uint16 = 0xffff
Functions ¶
func DtAbsFloat32 ¶
/ Returns the absolute value. / @param[in] a The value. / @return The absolute value of the specified value.
func DtAbsInt16 ¶
func DtAbsInt32 ¶
func DtAssertFailSetCustom ¶
func DtAssertFailSetCustom(assertFailFunc DtAssertFailFunc)
/ Sets the base custom assertion failure function to be used by Detour. / @param[in] assertFailFunc The function to be invoked in case of failure of #dtAssert
func DtCalcPolyCenter ¶
/ Derives the centroid of a convex polygon. / @param[out] tc The centroid of the polgyon. [(x, y, z)] / @param[in] idx The polygon indices. [(vertIndex) * @p nidx] / @param[in] nidx The number of indices in the polygon. [Limit: >= 3] / @param[in] verts The polygon vertices. [(x, y, z) * vertCount]
func DtClampFloat32 ¶
/ Clamps the value to the specified range. / @param[in] v The value to clamp. / @param[in] mn The minimum permitted return value. / @param[in] mx The maximum permitted return value. / @return The value, clamped to the specified range.
func DtClampInt16 ¶
func DtClampInt32 ¶
func DtClampUInt16 ¶
func DtClampUInt32 ¶
func DtClosestHeightPointTriangle ¶
/ Derives the y-axis height of the closest point on the triangle from the specified reference point. / @param[in] p The reference point from which to test. [(x, y, z)] / @param[in] a Vertex A of triangle ABC. [(x, y, z)] / @param[in] b Vertex B of triangle ABC. [(x, y, z)] / @param[in] c Vertex C of triangle ABC. [(x, y, z)] / @param[out] h The resulting height.
func DtClosestPtPointTriangle ¶
func DtClosestPtPointTriangle(closest, p, a, b, c []float32)
/ Derives the closest point on a triangle from the specified reference point. / @param[out] closest The closest point on the triangle. / @param[in] p The reference point from which to test. [(x, y, z)] / @param[in] a Vertex A of triangle ABC. [(x, y, z)] / @param[in] b Vertex B of triangle ABC. [(x, y, z)] / @param[in] c Vertex C of triangle ABC. [(x, y, z)]
func DtCreateNavMeshData ¶
func DtCreateNavMeshData(params *DtNavMeshCreateParams, outData *[]byte, outDataSize *int) bool
/ Builds navigation mesh tile data from the provided tile creation data. / @ingroup detour / @param[in] params Tile creation data. / @param[out] outData The resulting tile data. / @param[out] outDataSize The size of the tile data array. / @return True if the tile data was successfully created. / @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 DtDistancePtSegSqr2D ¶
func DtFreeDtQueryFilter ¶
func DtFreeDtQueryFilter(filter *DtQueryFilter)
func DtFreeNavMesh ¶
func DtFreeNavMesh(navmesh *DtNavMesh)
/ Frees the specified navigation mesh object using the Detour allocator. / @param[in] navmesh A navigation mesh allocated using #dtAllocNavMesh / @ingroup detour
func DtFreeNavMeshQuery ¶
func DtFreeNavMeshQuery(query *DtNavMeshQuery)
/ Frees the specified query object using the Detour allocator. / @param[in] query A query object allocated using #dtAllocNavMeshQuery / @ingroup detour
func DtFreeNodePool ¶
func DtFreeNodePool(pool *DtNodePool)
func DtFreeNodeQueue ¶
func DtFreeNodeQueue(queue *DtNodeQueue)
func DtIgnoreUnused ¶
func DtIgnoreUnused(interface{})
/ Used to ignore a function parameter. VS complains about unused parameters / and this silences the warning. / @param [in] _ Unused parameter
func DtIntersectSegSeg2D ¶
func DtMathAtan2f ¶
func DtMathCeilf ¶
func DtMathCosf ¶
func DtMathFabsf ¶
func DtMathFloorf ¶
func DtMathSinf ¶
func DtMathSqrtf ¶
func DtMaxFloat32 ¶
/ Returns the maximum of two values. / @param[in] a Value A / @param[in] b Value B / @return The maximum of the two values.
func DtMaxInt16 ¶
func DtMaxInt32 ¶
func DtMaxUInt16 ¶
func DtMaxUInt32 ¶
func DtMaxUInt8 ¶
func DtMinFloat32 ¶
/ Returns the minimum of two values. / @param[in] a Value A / @param[in] b Value B / @return The minimum of the two values.
func DtMinInt16 ¶
func DtMinInt32 ¶
func DtMinUInt16 ¶
func DtMinUInt32 ¶
func DtNavMeshDataSwapEndian ¶
/ Swaps endianess of the tile data. / @param[in,out] data The tile data array. / @param[in] dataSize The size of the data array. / @par / / @warning This function assumes that the header is in the correct endianess already. / Call #dtNavMeshHeaderSwapEndian() first on the data if the data is expected to be in wrong endianess / to start with. Call #dtNavMeshHeaderSwapEndian() after the data has been swapped if converting from / native to foreign endianess.
func DtNavMeshHeaderSwapEndian ¶
/ Swaps the endianess of the tile data's header (#dtMeshHeader). / @param[in,out] data The tile data array. / @param[in] dataSize The size of the data array.
func DtNextPow2 ¶
func DtOppositeTile ¶
func DtOverlapBounds ¶
/ Determines if two axis-aligned bounding boxes overlap. / @param[in] amin Minimum bounds of box A. [(x, y, z)] / @param[in] amax Maximum bounds of box A. [(x, y, z)] / @param[in] bmin Minimum bounds of box B. [(x, y, z)] / @param[in] bmax Maximum bounds of box B. [(x, y, z)] / @return True if the two AABB's overlap. / @see dtOverlapQuantBounds
func DtOverlapPolyPoly2D ¶
/ Determines if the two convex polygons overlap on the xz-plane. / @param[in] polya Polygon A vertices. [(x, y, z) * @p npolya] / @param[in] npolya The number of vertices in polygon A. / @param[in] polyb Polygon B vertices. [(x, y, z) * @p npolyb] / @param[in] npolyb The number of vertices in polygon B. / @return True if the two polygons overlap.
func DtOverlapQuantBounds ¶
/ Determines if two axis-aligned bounding boxes overlap. / @param[in] amin Minimum bounds of box A. [(x, y, z)] / @param[in] amax Maximum bounds of box A. [(x, y, z)] / @param[in] bmin Minimum bounds of box B. [(x, y, z)] / @param[in] bmax Maximum bounds of box B. [(x, y, z)] / @return True if the two AABB's overlap. / @see dtOverlapBounds
func DtPointInPolygon ¶
/ Determines if the specified point is inside the convex polygon on the xz-plane. / @param[in] pt The point to check. [(x, y, z)] / @param[in] verts The polygon vertices. [(x, y, z) * @p nverts] / @param[in] nverts The number of vertices. [Limit: >= 3] / @return True if the point is inside the polygon.
func DtRandomPointInConvexPoly ¶
func DtRandomPointInConvexPoly(pts []float32, npts int, areas []float32, s, t float32, out []float32)
Returns a random point in a convex polygon. Adapted from Graphics Gems article.
func DtSqrFloat32 ¶
/ Returns the square of the value. / @param[in] a The value. / @return The square of the value.
func DtSqrInt16 ¶
func DtSqrInt32 ¶
func DtSqrUInt16 ¶
func DtSqrUInt32 ¶
func DtStatusDetail ¶
Returns true if specific detail is set.
func DtStatusInProgress ¶
Returns true of status is in progress.
func DtStatusSucceed ¶
Returns true of status is success.
func DtSwapByte ¶
func DtSwapByte(a, b *uint8)
func DtSwapEndianFloat32 ¶
func DtSwapEndianFloat32(v *float32)
func DtSwapEndianInt16 ¶
func DtSwapEndianInt16(v *int16)
func DtSwapEndianInt32 ¶
func DtSwapEndianInt32(v *int32)
func DtSwapEndianUInt16 ¶
func DtSwapEndianUInt16(v *uint16)
func DtSwapEndianUInt32 ¶
func DtSwapEndianUInt32(v *uint32)
func DtSwapFloat32 ¶
func DtSwapFloat32(a, b *float32)
/ Swaps the values of the two parameters. / @param[in,out] a Value A / @param[in,out] b Value B
func DtSwapInt16 ¶
func DtSwapInt16(a, b *int16)
func DtSwapInt32 ¶
func DtSwapInt32(a, b *int32)
func DtSwapUInt16 ¶
func DtSwapUInt16(a, b *uint16)
func DtSwapUInt32 ¶
func DtSwapUInt32(a, b *uint32)
func DtTriArea2D ¶
/ Derives the signed xz-plane area of the triangle ABC, or the relationship of line AB to point C. / @param[in] a Vertex A. [(x, y, z)] / @param[in] b Vertex B. [(x, y, z)] / @param[in] c Vertex C. [(x, y, z)] / @return The signed xz-plane area of the triangle.
func DtVadd ¶
func DtVadd(dest, v1, v2 []float32)
/ Performs a vector addition. (@p v1 + @p v2) / @param[out] dest The result vector. [(x, y, z)] / @param[in] v1 The base vector. [(x, y, z)] / @param[in] v2 The vector to add to @p v1. [(x, y, z)]
func DtVcopy ¶
func DtVcopy(dest, a []float32)
/ Performs a vector copy. / @param[out] dest The result. [(x, y, z)] / @param[in] a The vector to copy. [(x, y, z)]
func DtVcross ¶
func DtVcross(dest, v1, v2 []float32)
/ Derives the cross product of two vectors. (@p v1 x @p v2) / @param[out] dest The cross product. [(x, y, z)] / @param[in] v1 A Vector [(x, y, z)] / @param[in] v2 A vector [(x, y, z)]
func DtVdist ¶
/ Returns the distance between two points. / @param[in] v1 A point. [(x, y, z)] / @param[in] v2 A point. [(x, y, z)] / @return The distance between the two points.
func DtVdist2D ¶
/ Derives the distance between the specified points on the xz-plane. / @param[in] v1 A point. [(x, y, z)] / @param[in] v2 A point. [(x, y, z)] / @return The distance between the point on the xz-plane. / / The vectors are projected onto the xz-plane, so the y-values are ignored.
func DtVdist2DSqr ¶
/ Derives the square of the distance between the specified points on the xz-plane. / @param[in] v1 A point. [(x, y, z)] / @param[in] v2 A point. [(x, y, z)] / @return The square of the distance between the point on the xz-plane.
func DtVdistSqr ¶
/ Returns the square of the distance between two points. / @param[in] v1 A point. [(x, y, z)] / @param[in] v2 A point. [(x, y, z)] / @return The square of the distance between the two points.
func DtVdot ¶
/ Derives the dot product of two vectors. (@p v1 . @p v2) / @param[in] v1 A Vector [(x, y, z)] / @param[in] v2 A vector [(x, y, z)] / @return The dot product.
func DtVdot2D ¶
/ Derives the dot product of two vectors on the xz-plane. (@p u . @p v) / @param[in] u A vector [(x, y, z)] / @param[in] v A vector [(x, y, z)] / @return The dot product on the xz-plane. / / The vectors are projected onto the xz-plane, so the y-values are ignored.
func DtVequal ¶
/ Performs a 'sloppy' colocation check of the specified points. / @param[in] p0 A point. [(x, y, z)] / @param[in] p1 A point. [(x, y, z)] / @return True if the points are considered to be at the same location. / / Basically, this function will return true if the specified points are / close enough to eachother to be considered colocated.
func DtVlen ¶
/ Derives the scalar length of the vector. / @param[in] v The vector. [(x, y, z)] / @return The scalar length of the vector.
func DtVlenSqr ¶
/ Derives the square of the scalar length of the vector. (len * len) / @param[in] v The vector. [(x, y, z)] / @return The square of the scalar length of the vector.
func DtVlerp ¶
/ Performs a linear interpolation between two vectors. (@p v1 toward @p v2) / @param[out] dest The result vector. [(x, y, x)] / @param[in] v1 The starting vector. / @param[in] v2 The destination vector. / @param[in] t The interpolation factor. [Limits: 0 <= value <= 1.0]
func DtVmad ¶
/ Performs a scaled vector addition. (@p v1 + (@p v2 * @p s)) / @param[out] dest The result vector. [(x, y, z)] / @param[in] v1 The base vector. [(x, y, z)] / @param[in] v2 The vector to scale and add to @p v1. [(x, y, z)] / @param[in] s The amount to scale @p v2 by before adding to @p v1.
func DtVmax ¶
func DtVmax(mx, v []float32)
/ Selects the maximum value of each element from the specified vectors. / @param[in,out] mx A vector. (Will be updated with the result.) [(x, y, z)] / @param[in] v A vector. [(x, y, z)]
func DtVmin ¶
func DtVmin(mn, v []float32)
/ Selects the minimum value of each element from the specified vectors. / @param[in,out] mn A vector. (Will be updated with the result.) [(x, y, z)] / @param[in] v A vector. [(x, y, z)]
func DtVnormalize ¶
func DtVnormalize(v []float32)
/ Normalizes the vector. / @param[in,out] v The vector to normalize. [(x, y, z)]
func DtVperp2D ¶
/ Derives the xz-plane 2D perp product of the two vectors. (uz*vx - ux*vz) / @param[in] u The LHV vector [(x, y, z)] / @param[in] v The RHV vector [(x, y, z)] / @return The dot product on the xz-plane. / / The vectors are projected onto the xz-plane, so the y-values are ignored.
func DtVscale ¶
/ Scales the vector by the specified value. (@p v * @p t) / @param[out] dest The result vector. [(x, y, z)] / @param[in] v The vector to scale. [(x, y, z)] / @param[in] t The scaling factor.
func DtVset ¶
/ Sets the vector elements to the specified values. / @param[out] dest The result vector. [(x, y, z)] / @param[in] x The x-value of the vector. / @param[in] y The y-value of the vector. / @param[in] z The z-value of the vector.
Types ¶
type DtAssertFailFunc ¶
type DtAssertFailFunc func(expression bool)
/ An assertion failure function.
@param[in] expression asserted expression. @param[in] file Filename of the failed assertion. @param[in] line Line number of the failed assertion.
/ @see dtAssertFailSetCustom
func DtAssertFailGetCustom ¶
func DtAssertFailGetCustom() DtAssertFailFunc
/ Gets the base custom assertion failure function to be used by Detour.
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
type DtFindPathOptions ¶
type DtFindPathOptions int
/ Options for dtNavMeshQuery::initSlicedFindPath and updateSlicedFindPath
const (
DT_FINDPATH_ANY_ANGLE DtFindPathOptions = 0x02 ///< use raycasts during pathfind to "shortcut" (raycast still consider costs)
)
type DtLink ¶
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
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
type DtMeshTile ¶
type DtMeshTile struct { Salt uint32 ///< Counter describing modifications to the tile. LinksFreeList uint32 ///< Index to the next free link. Header *DtMeshHeader ///< The tile header. Polys []DtPoly ///< The tile polygons. [Size: dtMeshHeader::polyCount] Verts []float32 ///< The tile vertices. [Size: 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) * dtMeshHeader::detailTriCount] 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] Data []byte ///< The tile data. (Not directly accessed under normal situations.) DataSize int32 ///< Size of the tile data. Flags DtTileFlags ///< Tile flags. (See: #dtTileFlags) Next *DtMeshTile ///< The next free tile, or the next tile in the spatial grid. }
/ Defines a navigation mesh tile. / @ingroup detour
type DtNavMesh ¶
type DtNavMesh struct {
// contains filtered or unexported fields
}
/ A navigation mesh based on tiles of convex polygons. / @ingroup detour
func DtAllocNavMesh ¶
func DtAllocNavMesh() *DtNavMesh
/ Allocates a navigation mesh object using the Detour allocator. / @return A navigation mesh that is ready for initialization, or null on failure. / @ingroup detour
func (*DtNavMesh) AddTile ¶
func (this *DtNavMesh) AddTile(data []byte, dataSize int, flags DtTileFlags, lastRef DtTileRef, result *DtTileRef) DtStatus
/ 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. / @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 ¶
/ 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)
func (*DtNavMesh) DecodePolyId ¶
/ 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 ¶
/ Extracts the polygon's index (within its tile) 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) DecodePolyIdSalt ¶
/ 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 ¶
/ 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
func (*DtNavMesh) EncodePolyId ¶
/ 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) GetMaxTiles ¶
/ The maximum number of tiles supported by the navigation mesh. / @return The maximum number of tiles supported by the navigation mesh.
func (*DtNavMesh) GetNeighbourTilesAt ¶
func (this *DtNavMesh) GetNeighbourTilesAt(x, y int32, side int, tiles []*DtMeshTile, maxTiles int) int
/ Returns neighbour tile based on side.
func (*DtNavMesh) GetOffMeshConnectionByRef ¶
func (this *DtNavMesh) GetOffMeshConnectionByRef(ref DtPolyRef) *DtOffMeshConnection
/ 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.
func (*DtNavMesh) GetOffMeshConnectionPolyEndPoints ¶
func (this *DtNavMesh) GetOffMeshConnectionPolyEndPoints(prevRef, polyRef DtPolyRef, startPos, endPos []float32) DtStatus
/ 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. / @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 (this *DtNavMesh) GetParams() *DtNavMeshParams
/ The navigation mesh initialization params. / @par / / @note The parameters are created automatically when the single tile / initialization is performed.
func (*DtNavMesh) GetPolyArea ¶
/ 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.
func (*DtNavMesh) GetPolyFlags ¶
/ 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.
func (*DtNavMesh) GetPolyRefBase ¶
func (this *DtNavMesh) GetPolyRefBase(tile *DtMeshTile) DtPolyRef
/ 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. / @par / / Example use case: / @code / / const dtPolyRef base = navmesh->getPolyRefBase(tile); / for (int i = 0; i < tile->header->polyCount; ++i) / { / const dtPoly* p = &tile->polys[i]; / const dtPolyRef ref = base | (dtPolyRef)i; / / // Use the reference to access the polygon data. / } / @endcode
func (*DtNavMesh) GetTile ¶
func (this *DtNavMesh) GetTile(i int) *DtMeshTile
/ Returns pointer to tile in the tile array.
func (*DtNavMesh) GetTileAndPolyByRef ¶
func (this *DtNavMesh) GetTileAndPolyByRef(ref DtPolyRef, tile **DtMeshTile, poly **DtPoly) DtStatus
/ 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.
func (*DtNavMesh) GetTileAndPolyByRefUnsafe ¶
func (this *DtNavMesh) GetTileAndPolyByRefUnsafe(ref DtPolyRef, tile **DtMeshTile, poly **DtPoly)
/ 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. / @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 (this *DtNavMesh) GetTileAt(x, y, layer int32) *DtMeshTile
/ 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.
func (*DtNavMesh) GetTileByRef ¶
func (this *DtNavMesh) GetTileByRef(ref DtTileRef) *DtMeshTile
/ 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.
func (*DtNavMesh) GetTileRef ¶
func (this *DtNavMesh) GetTileRef(tile *DtMeshTile) DtTileRef
/ Gets the tile reference for the specified tile. / @param[in] tile The tile. / @return The tile reference of the tile.
func (*DtNavMesh) GetTileRefAt ¶
/ 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.
func (*DtNavMesh) GetTileStateSize ¶
func (this *DtNavMesh) GetTileStateSize(tile *DtMeshTile) int
/ Gets the size of the buffer required by #storeTileState to store the specified tile's state. / @param[in] tile The tile. / @return The size of the buffer required to store the state.
func (*DtNavMesh) GetTilesAt ¶
func (this *DtNavMesh) GetTilesAt(x, y int32, tiles []*DtMeshTile, maxTiles int) int
/ 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. / @par / / This function will not fail if the tiles array is too small to hold the / entire result set. It will simply fill the array to capacity.
func (*DtNavMesh) Init ¶
func (this *DtNavMesh) Init(params *DtNavMeshParams) DtStatus
/ Initializes the navigation mesh for tiled use. / @param[in] params Initialization parameters. / @return The status flags for the operation.
func (*DtNavMesh) Init2 ¶
func (this *DtNavMesh) Init2(data []byte, dataSize int, flags DtTileFlags) 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 (*DtNavMesh) IsValidPolyRef ¶
/ 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.
func (*DtNavMesh) RemoveTile ¶
/ Removes the specified tile from the navigation mesh. / @param[in] ref The reference of the tile to remove. / @param[out] data Data associated with deleted tile. / @param[out] dataSize Size of the data associated with deleted tile. / @return The status flags for the operation. / @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.
func (*DtNavMesh) RestoreTileState ¶
func (this *DtNavMesh) RestoreTileState(tile *DtMeshTile, data []byte, maxDataSize int) 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. / @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 ¶
/ 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.
func (*DtNavMesh) SetPolyFlags ¶
/ 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.
func (*DtNavMesh) StoreTileState ¶
func (this *DtNavMesh) StoreTileState(tile *DtMeshTile, data []byte, maxDataSize int) DtStatus
/ Stores the non-structural state of the tile in the specified buffer. (Flags, area ids, etc.) / @param[in] tile The tile. / @param[out] data The buffer to store the tile's state in. / @param[in] maxDataSize The size of the data buffer. [Limit: >= #getTileStateSize] / @return The status flags for the operation. / @par / / Tile state includes non-structural data such as polygon flags, area ids, etc. / @note The state data is only valid until the tile reference changes. / @see #getTileStateSize, #restoreTileState
type DtNavMeshCreateParams ¶
type DtNavMeshCreateParams struct { float32 OffMeshConRad []float32 OffMeshConFlags []uint16 OffMeshConAreas []uint8 /// /// 0 = Travel only from endpoint A to endpoint B.<br/> /// #DT_OFFMESH_CON_BIDIR = Bidirectional travel. OffMeshConDir []uint8 OffMeshConUserID []uint32 OffMeshConCount int32 /// @note The BVTree is not normally needed for layered navigation meshes. BuildBvTree bool }OffMeshConVerts []
/ Represents the source data used to build an navigation mesh tile. / @ingroup detour
type DtNavMeshParams ¶
type DtNavMeshParams struct {}
/ 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
type DtNavMeshQuery ¶
type DtNavMeshQuery struct {
// contains filtered or unexported fields
}
func DtAllocNavMeshQuery ¶
func DtAllocNavMeshQuery() *DtNavMeshQuery
/ Allocates a query object using the Detour allocator. / @return An allocated query object, or null on failure. / @ingroup detour
func (*DtNavMeshQuery) ClosestPointOnPoly ¶
func (this *DtNavMeshQuery) ClosestPointOnPoly(ref DtPolyRef, pos, closest []float32, posOverPoly *bool) 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. / @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 (this *DtNavMeshQuery) ClosestPointOnPolyBoundary(ref DtPolyRef, pos, closest []float32) 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. / @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 (this *DtNavMeshQuery) FinalizeSlicedFindPath(path []DtPolyRef, pathCount *int, maxPath int) 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.
func (*DtNavMeshQuery) FinalizeSlicedFindPathPartial ¶
func (this *DtNavMeshQuery) FinalizeSlicedFindPathPartial(existing []DtPolyRef, existingSize int, path []DtPolyRef, pathCount *int, maxPath int) 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.
func (*DtNavMeshQuery) FindDistanceToWall ¶
func (this *DtNavMeshQuery) FindDistanceToWall(startRef DtPolyRef, centerPos []float32, maxRadius float32, filter *DtQueryFilter, hitDist *float32, hitPos []float32, hitNormal []float32) 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. / @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 (this *DtNavMeshQuery) FindLocalNeighbourhood(startRef DtPolyRef, centerPos []float32, radius float32, filter *DtQueryFilter, resultRef, resultParent []DtPolyRef, resultCount *int, maxResult int) 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. / @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 (this *DtNavMeshQuery) FindNearestPoly(center, halfExtents []float32, filter *DtQueryFilter, nearestRef *DtPolyRef, nearestPt []float32) DtStatus
/ Finds the polygon nearest to the specified center point. / @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. / @param[out] nearestPt The nearest point on the polygon. [opt] [(x, y, z)] / @returns The status flags for the query. / @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) FindPath ¶
func (this *DtNavMeshQuery) FindPath(startRef, endRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, path []DtPolyRef, pathCount *int, maxPath int) DtStatus
/ Finds a path from the start polygon to the end polygon. / @param[in] startRef The refrence 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] / @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 (this *DtNavMeshQuery) FindPolysAroundCircle(startRef DtPolyRef, centerPos []float32, radius float32, filter *DtQueryFilter, resultRef, resultParent []DtPolyRef, resultCost []float32, resultCount *int, maxResult int) 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. / @par / / At least one result array must be provided. / / The order of the result set is from least to highest cost to reach the polygon. / / 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. / / If a polygon is not found via the graph search, even if it intersects the / search circle, it will not be included in the result set. For example: / / polyA is the start polygon. / polyB shares an edge with polyA. (Is adjacent.) / polyC shares an edge with polyB, but not with polyA / Even if the search circle overlaps polyC, it will not be included in the / result set unless polyB is also in the set. / / The value of the center point is used as the start position 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 to small to hold the entire result set, they will be / filled to capacity. /
func (*DtNavMeshQuery) FindPolysAroundShape ¶
func (this *DtNavMeshQuery) FindPolysAroundShape(startRef DtPolyRef, verts []float32, nverts int, filter *DtQueryFilter, resultRef, resultParent []DtPolyRef, resultCost []float32, resultCount *int, maxResult int) 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. / @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 (this *DtNavMeshQuery) FindRandomPoint(filter *DtQueryFilter, frand func() float32, randomRef *DtPolyRef, randomPt []float32) 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 (this *DtNavMeshQuery) FindRandomPointAroundCircle(startRef DtPolyRef, centerPos []float32, maxRadius float32, filter *DtQueryFilter, frand func() float32, randomRef *DtPolyRef, randomPt []float32) 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] 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.
func (*DtNavMeshQuery) FindStraightPath ¶
func (this *DtNavMeshQuery) FindStraightPath(startPos, endPos []float32, path []DtPolyRef, pathSize int, straightPath []float32, straightPathFlags []DtStraightPathFlags, straightPathRefs []DtPolyRef, straightPathCount *int, maxStraightPath int, options DtStraightPathOptions) 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. / @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 (this *DtNavMeshQuery) GetAttachedNavMesh() *DtNavMesh
/ Gets the navigation mesh the query object is using. / @return The navigation mesh the query object is using.
func (*DtNavMeshQuery) GetNodePool ¶
func (this *DtNavMeshQuery) GetNodePool() *DtNodePool
/ Gets the node pool. / @returns The node pool.
func (*DtNavMeshQuery) GetPathFromDijkstraSearch ¶
func (this *DtNavMeshQuery) GetPathFromDijkstraSearch(endRef DtPolyRef, path []DtPolyRef, pathCount *int, maxPath int) 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.
func (*DtNavMeshQuery) GetPolyHeight ¶
func (this *DtNavMeshQuery) GetPolyHeight(ref DtPolyRef, pos []float32, height *float32) 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. / @par / / Will return #DT_FAILURE if the provided position is outside the xz-bounds / of the polygon. /
func (*DtNavMeshQuery) GetPolyWallSegments ¶
func (this *DtNavMeshQuery) GetPolyWallSegments(ref DtPolyRef, filter *DtQueryFilter, segmentVerts []float32, segmentRefs []DtPolyRef, segmentCount *int, maxSegments int) 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. / @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) Init ¶
func (this *DtNavMeshQuery) Init(nav *DtNavMesh, maxNodes int) DtStatus
/ 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. / @par / / Must be the first function called after construction, before other / functions are used. / / This function can be used multiple times.
func (*DtNavMeshQuery) InitSlicedFindPath ¶
func (this *DtNavMeshQuery) InitSlicedFindPath(startRef, endRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, options DtFindPathOptions) DtStatus
/ Intializes a sliced path query. / @param[in] startRef The refrence 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. / @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 (this *DtNavMeshQuery) IsInClosedList(ref DtPolyRef) 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. / @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 (this *DtNavMeshQuery) IsValidPolyRef(ref DtPolyRef, filter *DtQueryFilter) bool
/ 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.
func (*DtNavMeshQuery) MoveAlongSurface ¶
func (this *DtNavMeshQuery) MoveAlongSurface(startRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, resultPos []float32, visited []DtPolyRef, visitedCount *int, maxVisitedSize int, bHit *bool) 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. / @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 (this *DtNavMeshQuery) QueryPolygons(center, halfExtents []float32, filter *DtQueryFilter, polys []DtPolyRef, polyCount *int, maxPolys int) 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. / @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) QueryPolygons2 ¶
func (this *DtNavMeshQuery) QueryPolygons2(center, 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[in] query The query. Polygons found will be batched together and passed to this query. / @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) Raycast ¶
func (this *DtNavMeshQuery) Raycast(startRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, t *float32, hitNormal []float32, path []DtPolyRef, pathCount *int, maxPath int) 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[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[in] filter The polygon filter to apply to the query. / @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. / @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) Raycast2 ¶
func (this *DtNavMeshQuery) Raycast2(startRef DtPolyRef, startPos, endPos []float32, filter *DtQueryFilter, options DtRaycastOptions, hit *DtRaycastHit, prevRef DtPolyRef) 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] flags 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. / @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 (this *DtNavMeshQuery) UpdateSlicedFindPath(maxIter int, doneIters *int) 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.
type DtNode ¶
type DtNode struct { Pos [3]float32 ///< Position of the node. Cost float32 ///< Cost from previous node to current node. Total float32 ///< Cost up to the node. Pidx uint32 ///< Index to parent node. State uint8 ///< extra state information. A polyRef can have multiple nodes with different extra info. see DT_MAX_STATES_PER_NODE Flags DtNodeFlags ///< Node flags. A combination of dtNodeFlags. Id DtPolyRef ///< Polygon ref the node corresponds to. }
type DtNodeFlags ¶
type DtNodeFlags uint8
const ( DT_NODE_OPEN DtNodeFlags = 0x01 DT_NODE_CLOSED DtNodeFlags = 0x02 DT_NODE_PARENT_DETACHED DtNodeFlags = 0x04 // parent of the node is not adjacent. Found using raycast. )
type DtNodePool ¶
type DtNodePool struct {
// contains filtered or unexported fields
}
func DtAllocNodePool ¶
func DtAllocNodePool(maxNodes, hashSize uint32) *DtNodePool
func (*DtNodePool) Clear ¶
func (this *DtNodePool) Clear()
func (*DtNodePool) FindNodes ¶
func (this *DtNodePool) FindNodes(id DtPolyRef, nodes []*DtNode, maxNodes uint32) uint32
func (*DtNodePool) GetFirst ¶
func (this *DtNodePool) GetFirst(bucket int) DtNodeIndex
func (*DtNodePool) GetHashSize ¶
func (this *DtNodePool) GetHashSize() uint32
func (*DtNodePool) GetMaxNodes ¶
func (this *DtNodePool) GetMaxNodes() uint32
func (*DtNodePool) GetMemUsed ¶
func (this *DtNodePool) GetMemUsed() uint32
func (*DtNodePool) GetNext ¶
func (this *DtNodePool) GetNext(i int) DtNodeIndex
func (*DtNodePool) GetNodeAtIdx ¶
func (this *DtNodePool) GetNodeAtIdx(idx uint32) *DtNode
func (*DtNodePool) GetNodeCount ¶
func (this *DtNodePool) GetNodeCount() uint32
func (*DtNodePool) GetNodeIdx ¶
func (this *DtNodePool) GetNodeIdx(node *DtNode) uint32
type DtNodeQueue ¶
type DtNodeQueue struct {
// contains filtered or unexported fields
}
func DtAllocNodeQueue ¶
func DtAllocNodeQueue(n int) *DtNodeQueue
func (*DtNodeQueue) Clear ¶
func (this *DtNodeQueue) Clear()
func (*DtNodeQueue) Empty ¶
func (this *DtNodeQueue) Empty() bool
func (*DtNodeQueue) GetCapacity ¶
func (this *DtNodeQueue) GetCapacity() int
func (*DtNodeQueue) GetMemUsed ¶
func (this *DtNodeQueue) GetMemUsed() uint32
func (*DtNodeQueue) Modify ¶
func (this *DtNodeQueue) Modify(node *DtNode)
func (*DtNodeQueue) Pop ¶
func (this *DtNodeQueue) Pop() *DtNode
func (*DtNodeQueue) Push ¶
func (this *DtNodeQueue) Push(node *DtNode)
func (*DtNodeQueue) Top ¶
func (this *DtNodeQueue) Top() *DtNode
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.
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 acess this value. AreaAndtype uint8 }
/ Defines a polygon within a dtMeshTile object. / @ingroup detour
func (*DtPoly) GetType ¶
func (this *DtPoly) GetType() DtPolyTypes
/ Gets the polygon type. (See: #dtPolyTypes)
func (*DtPoly) SetType ¶
func (this *DtPoly) SetType(t DtPolyTypes)
/ Sets the polygon type. (See: #dtPolyTypes.)
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.
type DtPolyQuery ¶
type DtPolyQuery interface { /// Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons. /// This can be called multiple times for a single query. Process(tile *DtMeshTile, polys []*DtPoly, refs []DtPolyRef, count int) }
/ Provides custom polygon query behavior. / Used by dtNavMeshQuery::queryPolygons. / @ingroup detour
type DtPolyRef ¶
type DtPolyRef uint32
/ A handle to a polygon within a navigation mesh tile. / @ingroup detour
type DtPolyTypes ¶
type DtPolyTypes uint8
/ Flags representing the type of a navigation mesh polygon.
const ( /// The polygon is a standard convex polygon that is part of the surface of the mesh. DT_POLYTYPE_GROUND DtPolyTypes = 0 /// The polygon is an off-mesh connection consisting of two vertices. DT_POLYTYPE_OFFMESH_CONNECTION DtPolyTypes = 1 )
type DtQueryFilter ¶
type DtQueryFilter struct {
// contains filtered or unexported fields
}
/ Defines polygon filtering and traversal costs for navigation mesh query operations. / @ingroup detour
func DtAllocDtQueryFilter ¶
func DtAllocDtQueryFilter() *DtQueryFilter
func (*DtQueryFilter) GetAreaCost ¶
func (this *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) GetCost ¶
func (this *DtQueryFilter) GetCost(pa, pb []float32, _ DtPolyRef, _ *DtMeshTile, _ *DtPoly, _ DtPolyRef, _ *DtMeshTile, curPoly *DtPoly, _ DtPolyRef, _ *DtMeshTile, _ *DtPoly) float32
func (*DtQueryFilter) GetExcludeFlags ¶
func (this *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 (this *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) PassFilter ¶
func (this *DtQueryFilter) PassFilter(_ DtPolyRef, _ *DtMeshTile, poly *DtPoly) bool
func (*DtQueryFilter) SetAreaCost ¶
func (this *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 (this *DtQueryFilter) SetExcludeFlags(flags uint16)
/ Sets the exclude flags for the filter. / @param[in] flags The new flags.
func (*DtQueryFilter) SetIncludeFlags ¶
func (this *DtQueryFilter) SetIncludeFlags(flags uint16)
/ Sets the include flags for the filter. / @param[in] flags The new flags.
type DtRaycastHit ¶
type DtRaycastHit struct { /// The hit parameter. (FLT_MAX if no wall hit.) T float32 /// hitNormal The normal of the nearest wall hit. [(x, y, z)] HitNormal [3]float32 /// The index of the edge on the final polygon where the wall was hit. HitEdgeIndex int32 /// Pointer to an array of reference ids of the visited polygons. [opt] Path []DtPolyRef /// The number of visited polygons. [opt] PathCount int32 /// The maximum number of polygons the @p path array can hold. MaxPath int32 /// The cost of the path until hit. PathCost float32 }
/ Provides information about raycast hit / filled by dtNavMeshQuery::raycast / @ingroup detour
type DtRaycastOptions ¶
type DtRaycastOptions int
/ Options for dtNavMeshQuery::raycast
const (
DT_RAYCAST_USE_COSTS DtRaycastOptions = 0x01 ///< Raycast should calculate movement cost along the ray and fill RaycastHit::cost
)
type DtStatus ¶
type DtStatus uint
const ( // High level status. DT_FAILURE DtStatus = 1 << 31 // Operation failed. DT_SUCCESS DtStatus = 1 << 30 // Operation succeed. DT_IN_PROGRESS DtStatus = 1 << 29 // Operation still in progress. // Detail information for status. DT_STATUS_DETAIL_MASK DtStatus = 0x0ffffff DT_WRONG_MAGIC DtStatus = 1 << 0 // Input data is not recognized. DT_WRONG_VERSION DtStatus = 1 << 1 // Input data is in wrong version. DT_OUT_OF_MEMORY DtStatus = 1 << 2 // Operation ran out of memory. DT_INVALID_PARAM DtStatus = 1 << 3 // An input parameter was invalid. DT_BUFFER_TOO_SMALL DtStatus = 1 << 4 // Result buffer for the query was too small to store all results. DT_OUT_OF_NODES DtStatus = 1 << 5 // Query ran out of nodes during search. DT_PARTIAL_RESULT DtStatus = 1 << 6 // Query did not reach the end location, returning best guess. DT_ALREADY_OCCUPIED DtStatus = 1 << 7 // A tile has already been assigned to the given x,y coordinate )
type DtStraightPathFlags ¶
type DtStraightPathFlags uint8
/ Vertex flags returned by dtNavMeshQuery::findStraightPath.
const ( DT_STRAIGHTPATH_START DtStraightPathFlags = 0x01 ///< The vertex is the start position in the path. DT_STRAIGHTPATH_END DtStraightPathFlags = 0x02 ///< The vertex is the end position in the path. DT_STRAIGHTPATH_OFFMESH_CONNECTION DtStraightPathFlags = 0x04 ///< The vertex is the start of an off-mesh connection. )
type DtStraightPathOptions ¶
type DtStraightPathOptions int
/ Options for dtNavMeshQuery::findStraightPath.
const ( DT_STRAIGHTPATH_AREA_CROSSINGS DtStraightPathOptions = 0x01 ///< Add a vertex at every polygon edge crossing where area changes. DT_STRAIGHTPATH_ALL_CROSSINGS DtStraightPathOptions = 0x02 ///< Add a vertex at every polygon edge crossing. )
type DtTileFlags ¶
type DtTileFlags int
/ Tile flags used for various functions and fields. / For an example, see dtNavMesh::addTile().
const ( /// The navigation mesh owns the tile memory and is responsible for freeing it. DT_TILE_FREE_DATA DtTileFlags = 0x01 )