unityai

package module
v0.0.0-...-c7e87eb Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: MIT Imports: 8 Imported by: 0

README

unityai

This is a golang port of Unity2018.3.6f1 AI module. You should use binary2text provided by Unity to convert the NavMesh.asset from binary to text format before you dive into this library. This library provide exact same logic as Unity NavMesh, so you can use it for your game server, if you are using Unity NavMesh in client.

Usage

The API is reserved as Unity NavMesh, so it should be convenient to use if you are familiar with Unity NavMesh API or RecastDetour. If you are not, you may want to read some examples in test folder.

Documentation

Index

Constants

View Source
const FLT_EPSILON float32 = 1.192092896e-07
View Source
const (
	H_SCALE float32 = 0.999 // Search heuristic scale.
)
View Source
const MAX_INTERVAL = 16

Variables

This section is empty.

Functions

func Align4

func Align4(value uintptr) uint32

func Assert

func Assert(v bool)

func ClosestHeightPointTriangle

func ClosestHeightPointTriangle(h *float32, p, a, b, c Vector3f) bool

func CompareApproximatelyQ

func CompareApproximatelyQ(q1, q2 Quaternionf, epsilon float32) bool

func CompareApproximatelyV

func CompareApproximatelyV(inV0, inV1 Vector3f, inMaxDist float32) bool

func DecodePolyId

func DecodePolyId(salt *uint32, it *uint32, typ *uint32, ip *uint32, ref NavMeshPolyRef)

Decodes a poly id.

func DecodePolyIdPoly

func DecodePolyIdPoly(ref NavMeshPolyRef) uint32

Decodes a poly id.

func DecodePolyIdSalt

func DecodePolyIdSalt(ref NavMeshPolyRef) uint32

Decodes a tile salt.

func DecodePolyIdTile

func DecodePolyIdTile(ref NavMeshPolyRef) uint32

Decodes a tile id.

func DecodePolyIdType

func DecodePolyIdType(ref NavMeshPolyRef) uint32

Decodes a type.

func Distance

func Distance(a, b Vector3f) float32

func Dot2D

func Dot2D(a, b Vector3f) float32

func DotQuaternionf

func DotQuaternionf(l, r Quaternionf) float32

func DotVector3f

func DotVector3f(l, r Vector3f) float32

func FindFurthestIntersectionIndices

func FindFurthestIntersectionIndices(a []NavMeshPolyRef, b []NavMeshPolyRef, na, nb int32, ia, ib *int32) bool

func FloatAbs

func FloatAbs(d float32) float32

func FloatClamp

func FloatClamp(v, min, max float32) float32

func FloatMax

func FloatMax(l, r float32) float32

func FloatMin

func FloatMin(l, r float32) float32

func FloorfToInt

func FloorfToInt(f float32) int32

func GetCostModifier

func GetCostModifier(navmesh *NavMesh, filter *QueryFilter, ref NavMeshPolyRef) float32

func GetNavMeshNodeIndex

func GetNavMeshNodeIndex(start, end *NavMeshNode) int32

func GetPolyIndex

func GetPolyIndex(tile *NavMeshTile, poly *NavMeshPoly) uint32

func GetSlabCoord

func GetSlabCoord(va Vector3f, side int32) float32

func GetTileIndex

func GetTileIndex(begin, end *NavMeshTile) int32

func HashRef

func HashRef(a NavMeshPolyRef) uint32

func InsertInterval

func InsertInterval(ints []SegInterval, nints int32, maxInts int32, tmin int16, tmax int16, ref NavMeshPolyRef) int32

func IntersectAABBAABB

func IntersectAABBAABB(a, b MinMaxAABB) bool

func IntersectSegmentPoly2D

func IntersectSegmentPoly2D(tmin, tmax *float32, segMin, segMax *int32, p0, p1 Vector3f, verts []Vector3f, nverts int32) bool

func IntersectionAABBAABB

func IntersectionAABBAABB(a, b MinMaxAABB, outBoxIntersect *MinMaxAABB) bool

func InvalidateNavMeshHit

func InvalidateNavMeshHit(hit *NavMeshHit)

func InverseTransformAABB

func InverseTransformAABB(aabb AABB, position Vector3f, rotation Quaternionf, result *AABB)

func IsPowerOfTwo

func IsPowerOfTwo(mask int32) bool

func IsSameTile

func IsSameTile(ref1, ref2 NavMeshPolyRef) bool

func LerpFloat32

func LerpFloat32(from, to, t float32) float32

func Magnitude

func Magnitude(inV Vector3f) float32

func MakeDetailEdgeSlabs

func MakeDetailEdgeSlabs(slabs []Vector2f, pts []Vector3f, npts int32, side int32)
func NavMeshStatusDetail(status NavMeshStatus, detail NavMeshStatus) bool

Returns true if specific detail is set.

func NavMeshStatusFailed(status NavMeshStatus) bool

Returns true of status is failure.

func NavMeshStatusInProgress(status NavMeshStatus) bool

Returns true of status is in progress.

func NavMeshStatusSucceed(status NavMeshStatus) bool

Returns true of status is success.

func NeighbourLocation

func NeighbourLocation(x *int32, y *int32, side int32)

func NexSurfaceId

func NexSurfaceId() int32

func NextIndex

func NextIndex(index, modulus int32) int32

func NextPowerOfTwo

func NextPowerOfTwo(v uint32) uint32

func OppositeTile

func OppositeTile(side int32) int32

func OverlapBounds

func OverlapBounds(amin, amax, bmin, bmax Vector3f) bool

func OverlapDetailSlabs

func OverlapDetailSlabs(aslabs []Vector2f, acount int32, bslabs []Vector2f, bcount int32, px float32, py float32) bool

func OverlapPolyPoly2D

func OverlapPolyPoly2D(polya []Vector3f, npolya int32, polyb []Vector3f, npolyb int32) bool

func OverlapQuantBounds

func OverlapQuantBounds(amin []uint16, amax []uint16, bmin []uint16, bmax []uint16) bool

func OverlapRange

func OverlapRange(amin, amax, bmin, bmax, eps float32) bool

func OverlapSlabs

func OverlapSlabs(amin Vector2f, amax Vector2f, bmin Vector2f, bmax Vector2f, px float32, py float32) bool

func Perp2D

func Perp2D(u, v Vector3f) float32

func PointInPolygon2D

func PointInPolygon2D(pt Vector3f, verts []Vector3f, nverts int32) bool

func ProjectPointToPoly2DLocal

func ProjectPointToPoly2DLocal(pos Vector3f, poly *NavMeshPoly, tile *NavMeshTile, projectedPos *Vector3f) bool

func ProjectPoly

func ProjectPoly(rmin, rmax *float32, axis Vector3f, poly []Vector3f, npoly int32)

func ProjectToPolyDetail

func ProjectToPolyDetail(tile *NavMeshTile, poly *NavMeshPoly, pos Vector3f, height *float32) bool

Project point height to detail triangle and accept immediately if the projected point is inside triangle

func ProjectToPolyDetailEdge

func ProjectToPolyDetailEdge(tile *NavMeshTile, poly *NavMeshPoly, pos Vector3f) float32

In the plane of projection find the height of the closest point on the edge of the detail triangles

func QuaternionToMatrix3

func QuaternionToMatrix3(q Quaternionf, m *Matrix3x3f)

func QuaternionToMatrix4

func QuaternionToMatrix4(q Quaternionf, m *Matrix4x4f)

func ReplacePathStart

func ReplacePathStart(path *[]NavMeshPolyRef, start []NavMeshPolyRef, nstart int32) bool

func ReplacePathStartReverse

func ReplacePathStartReverse(path *[]NavMeshPolyRef, start []NavMeshPolyRef, nstart int32) bool

func Sqr

func Sqr(x float32) float32

func SqrDistance

func SqrDistance(a, b Vector3f) float32

func SqrDistance2D

func SqrDistance2D(a, b Vector3f) float32

func SqrDistancePointPolyEdge

func SqrDistancePointPolyEdge(pt Vector3f, verts []Vector3f, nverts int32, ed, et []float32) bool

func SqrDistancePointSegment

func SqrDistancePointSegment(t *float32, pt Vector3f, s1 Vector3f, s2 Vector3f) float32

func SqrDistancePointSegment2D

func SqrDistancePointSegment2D(t *float32, pt, s1, s2 Vector3f) float32

func SqrMagnitude

func SqrMagnitude(inV Vector3f) float32

func SqrMagnitudeQ

func SqrMagnitudeQ(inV Quaternionf) float32

func SqrMagnitudeV

func SqrMagnitudeV(inV Vector3f) float32

func Sqrt

func Sqrt(v float32) float32

func TestPointInCylinder

func TestPointInCylinder(point Vector3f, center Vector3f, halfHeight float32, radius float32) bool

func TileToWorldBatch

func TileToWorldBatch(worldPositions []Vector3f, tile *NavMeshTile, npositions int, positions []Vector3f)

func TransformAABB

func TransformAABB(aabb AABB, position Vector3f, rotation Quaternionf, result *AABB)

func TransformAABBSlow

func TransformAABBSlow(aabb MinMaxAABB, transform Matrix4x4f, result *MinMaxAABB)

func TriangleAreaXZ

func TriangleAreaXZ(pa, pb, pc Vector3f) float32

calculate xz plan area of the triangle https://www.mathopenref.com/coordtrianglearea.html

Types

type AABB

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

func NewAABBFromMinMax

func NewAABBFromMinMax(data MinMaxAABB) AABB

func (*AABB) IsInside

func (this *AABB) IsInside(inPoint Vector3f) bool

func (*AABB) SetCenterAndExtent

func (this *AABB) SetCenterAndExtent(center, extent Vector3f)

type AutoOffMeshLinkData

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

type EdgePointSample

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

type EdgePointSamples

type EdgePointSamples []EdgePointSample

func (EdgePointSamples) Len

func (this EdgePointSamples) Len() int

func (EdgePointSamples) Less

func (this EdgePointSamples) Less(i, j int) bool

func (EdgePointSamples) Swap

func (this EdgePointSamples) Swap(i, j int)

type HeightMeshBVNode

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

type HeightMeshData

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

type LinkFreeList

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

func (*LinkFreeList) Alloc

func (this *LinkFreeList) Alloc() uint32

func (*LinkFreeList) Capacity

func (this *LinkFreeList) Capacity() uint32

func (*LinkFreeList) Get

func (this *LinkFreeList) Get(i uint32) *NavMeshLink

func (*LinkFreeList) Grow

func (this *LinkFreeList) Grow(s uint32)

func (*LinkFreeList) Init

func (this *LinkFreeList) Init()

func (*LinkFreeList) Release

func (this *LinkFreeList) Release(id uint32)

type Matrix3x3f

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

func (*Matrix3x3f) Get

func (this *Matrix3x3f) Get(row, column int) float32

func (*Matrix3x3f) MultiplyPoint3

func (this *Matrix3x3f) MultiplyPoint3(v Vector3f) Vector3f

func (*Matrix3x3f) MultiplyVector3

func (this *Matrix3x3f) MultiplyVector3(v Vector3f) Vector3f

type Matrix4x4f

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

func (*Matrix4x4f) Get

func (this *Matrix4x4f) Get(row, col int) float32

func (*Matrix4x4f) MultiplyPoint3

func (this *Matrix4x4f) MultiplyPoint3(v Vector3f) Vector3f

func (*Matrix4x4f) MultiplyVector3

func (this *Matrix4x4f) MultiplyVector3(v Vector3f) Vector3f

func (*Matrix4x4f) Set

func (this *Matrix4x4f) Set(row, col int, data float32)

func (*Matrix4x4f) SetTR

func (this *Matrix4x4f) SetTR(pos Vector3f, q Quaternionf)

func (*Matrix4x4f) SetTRInverse

func (this *Matrix4x4f) SetTRInverse(pos Vector3f, q Quaternionf)

func (*Matrix4x4f) Translate

func (this *Matrix4x4f) Translate(inTrans Vector3f)

type MinMaxAABB

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

func GetWorldTileBounds

func GetWorldTileBounds(tile NavMeshTile) MinMaxAABB

func NewMinMaxAABB

func NewMinMaxAABB(min, max Vector3f) MinMaxAABB

func NewMinMaxAABBFromAABB

func NewMinMaxAABBFromAABB(inAABB AABB) MinMaxAABB

func (*MinMaxAABB) CalculateVertices

func (this *MinMaxAABB) CalculateVertices(outVertices []Vector3f)

func (*MinMaxAABB) Encapsulate

func (this *MinMaxAABB) Encapsulate(other MinMaxAABB)

func (*MinMaxAABB) EncapsulateV

func (this *MinMaxAABB) EncapsulateV(inPoint Vector3f)

func (*MinMaxAABB) Init

func (this *MinMaxAABB) Init()
type NavMesh struct {
	// contains filtered or unexported fields
}

func NewNavMesh

func NewNavMesh() *NavMesh
func (this *NavMesh) AddOffMeshConnection(params *OffMeshConnectionParams, connectRadius float32, connectHeight float32) NavMeshPolyRef
func (this *NavMesh) AddTile(data []byte, dataSize int32, flags NavMeshTileFlags, surfaceID int32, result *NavMeshTileRef) NavMeshStatus

Adds new tile into the navmesh. The add will fail if the data is in wrong format, there is not enough tiles left, or if there is a tile already at the location. Params:

data - (in) Data of the new tile mesh.
dataSize - (in) Data size of the new tile mesh.
flags - (in) Tile flags, see NavMeshTileFlags.
surfaceID - (in) surface identifier for the tile.
result - (out,optional) tile ref if the tile was successfully added.
func (this *NavMesh) BumpTimeStamp()
func (this *NavMesh) ClosestPointOnPolyInTileLocal(tile *NavMeshTile, poly *NavMeshPoly, pos Vector3f, closest *Vector3f)

Returns closest point on polygon.

func (this *NavMesh) ConnectExtLinks(tile *NavMeshTile, target *NavMeshTile, side int32, portalHeight float32)

Builds external polygon links for a tile.

func (this *NavMesh) ConnectIntLinks(tile *NavMeshTile)

Builds internal polygons links for a tile.

func (this *NavMesh) ConnectOffMeshConnection(index uint32, connectRadius float32, connectHeight float32)
func (this *NavMesh) ConnectOffMeshConnectionsToTile(tile *NavMeshTile)
func (this *NavMesh) CreateSurface(reserveTileCount int, settings NavMeshBuildSettings, pos Vector3f, rot Quaternionf) int32

Creates a surface - set of tiles sharing some data Reserves room for tiles belonging for a given surface. Params:

tileCount - (in) number of tiles to reserve memory for.
settings - (in) settings for tiles belonging to this surface.
func (this *NavMesh) FindConnectingPolys(fromPoints []Vector3f, fromPointCount int32,
	tile *NavMeshTile, side int32, con []NavMeshPolyRef, conarea []PortalArea,
	maxcon int32, portalHeight float32) int32

Returns all polygons in neighbour tile based on portal defined by the segment.

func (this *NavMesh) FindNearestPoly(typeID int32, center Vector3f, extents Vector3f, nearestPt *Vector3f) NavMeshPolyRef

Find nearest polygon within a tile.

func (this *NavMesh) FindPolygonsOverlappingSegment(typeID int32, pa Vector3f, pb Vector3f, height float32, polys []NavMeshPolyRef, overlapMinMax []float32, polyCount *int, maxPolys int)
func (this *NavMesh) GetAgentTypeIdForPolyRef(ref NavMeshPolyRef) int32

Returns the agentTypeId that is allowed to use the polygon.

func (this *NavMesh) GetFirstLink(ref NavMeshPolyRef) *NavMeshLink
func (this *NavMesh) GetFirstOffMeshConnection() *OffMeshConnection
func (this *NavMesh) GetLink(i uint32) *NavMeshLink
func (this *NavMesh) GetMaxTiles() uint32

Returns the number of tiles currently allocated. Use together with GetTile to access all tiles.

func (this *NavMesh) GetNearestOffMeshConnectionEndPoints(prevRef NavMeshPolyRef, offMeshPolyRef NavMeshPolyRef, nextRef NavMeshPolyRef, currentPos Vector3f, startPos *Vector3f, endPos *Vector3f) NavMeshStatus
func (this *NavMesh) GetNextLink(link *NavMeshLink) *NavMeshLink
func (this *NavMesh) GetNextOffMeshConnection(data *OffMeshConnection) *OffMeshConnection
func (this *NavMesh) GetOffMeshConnection(ref NavMeshPolyRef) *OffMeshConnection
func (this *NavMesh) GetOffMeshConnectionEndPoints(prevRef NavMeshPolyRef, offMeshPolyRef NavMeshPolyRef, startPos *Vector3f, endPos *Vector3f) NavMeshStatus

Returns start and end location of an off-mesh link polygon. As seen when approached from prevRef. Returns start and end location of an off-mesh link polygon. Params:

prevRef - (in) ref to the polygon before the link (used to select direction).
polyRef - (in) ref to the off-mesh link polygon.
startPos[3] - (out) start point of the link.
endPos[3] - (out) end point of the link.

Returns: true if link is found.

func (this *NavMesh) GetOffMeshConnectionUnsafe(ref NavMeshPolyRef) *OffMeshConnection
func (this *NavMesh) GetOffMeshConnectionUserID(ref NavMeshPolyRef, userID *int32) NavMeshStatus
func (this *NavMesh) GetPolyArea(ref NavMeshPolyRef) byte
func (this *NavMesh) GetPolyEdgeDetailPoints(tile *NavMeshTile, p int32, edge int32,
	points []Vector3f, pointCount *int32, maxPoints int32) NavMeshStatus

Returns polygon edge points based on detail mesh. If 'maxPoints' is less than the number of points on the edge, the edge is simplified. Params:

tile - (in) pointer to tile where the polygon lies.
poly - (in) polygon index
edge - (in) edge index
points - (out) array to store the edge points (maxPoints*3).
pointCount - (out) number of points stored.
maxPoints - (in) max number of points that can fit into points, must be >= 2.
func (this *NavMesh) GetPolyFlags(ref NavMeshPolyRef) uint32
func (this *NavMesh) GetPolyFlagsAndArea(ref NavMeshPolyRef, flags *uint32, area *byte)
func (this *NavMesh) GetPolyGeometry(ref NavMeshPolyRef, verts []Vector3f, neighbours []NavMeshPolyRef, maxNeisPerEdge int32) int32

Returns vertices and neighbours of polygon pointed to by the polygon reference. Note: this function returns 0 if ref is invalid Params:

ref - (in) reference to a polygon.
verts - (out, optional) pointer to polygon vertices, must have a capacity of at least kNavMeshVertsPerPoly.
neighbours - (out, optional) pointer to the polygon neighbours, must have a capacity of at least kNavMeshVertsPerPoly*maxNeisPerEdge.
maxNeisPerEdge - (int) maximum number of neighbours stored in 'neighbours' per edge.
func (this *NavMesh) GetPolyRefBase(tile *NavMeshTile) NavMeshPolyRef

Returns base poly id for specified tile, polygon refs can be deducted from this.

func (this *NavMesh) GetSurfaceSettings(surfaceID int32) *NavMeshBuildSettings
func (this *NavMesh) GetSurfaceTransform(surfaceID int32, pos *Vector3f, rot *Quaternionf) NavMeshStatus
func (this *NavMesh) GetTile(i int32) *NavMeshTile

Returns a pointer to tile in the tile free list. If the tile 'header' pointer is 0, the tile is invalid. Params:

i - (in) Index to the tile to retrieve, max index is GetMaxTiles()-1.

Returns: Pointer to specified tile.

func (this *NavMesh) GetTileAndPolyByRef(ref NavMeshPolyRef, tile **NavMeshTile, poly **NavMeshPoly) NavMeshStatus

Returns pointer to tile and polygon pointed by the polygon reference. Params:

ref - (in) reference to a polygon.
tile - (out) pointer to the tile containing the polygon.
poly - (out) pointer to the polygon.
func (this *NavMesh) GetTileAndPolyByRefUnsafe(ref NavMeshPolyRef, tile **NavMeshTile, poly **NavMeshPoly)

Returns pointer to tile and polygon pointed by the polygon reference. Note: this function does not check if 'ref' s valid, and is thus faster. Use only with valid refs! Params:

ref - (in) reference to a polygon.
tile - (out) pointer to the tile containing the polygon.
poly - (out) pointer to the polygon.
func (this *NavMesh) GetTileByRef(ref NavMeshTileRef) *NavMeshTile

Returns tile based on references.

func (this *NavMesh) GetTileRef(tile *NavMeshTile) NavMeshTileRef

Returns tile references of a tile based on tile pointer.

func (this *NavMesh) GetTimeStamp() uint32
func (this *NavMesh) IsValidPolyRef(ref NavMeshPolyRef) bool

Returns true if polygon reference points to valid data.

func (this *NavMesh) QueryPolygons(typeID int32, cen Vector3f, ext Vector3f, callback NavMeshProcessCallback)

Returns polygons which overlap the query box. Params:

typeID - (in) query surfaces with this id. -1 means query all surfaces.
center[3] - (in) the center of the search box.
extents[3] - (in) the extents of the search box.
callback - (in/out) pointer to callback interface to batch-process the results, see NavMeshProcessCallback.
func (this *NavMesh) QueryPolygonsInTile(tile *NavMeshTile, center Vector3f, extents Vector3f, callback NavMeshProcessCallback)

Queries polygons within a tile.

func (this *NavMesh) RemoveLinkBetween(from NavMeshPolyRef, to NavMeshPolyRef)
func (this *NavMesh) RemoveOffMeshConnection(ref NavMeshPolyRef) NavMeshStatus
func (this *NavMesh) RemoveSurface(surfaceID int32)

Removes a surface Params:

surfaceID - (in) id of surface to remove.
func (this *NavMesh) RemoveTile(ref NavMeshTileRef, surfaceID int32, data *[]byte, dataSize *int32) NavMeshStatus

Removes specified tile. Params:

ref - (in) Reference to the tile to remove.
surfaceID - (in) surface identifier for the tile
data - (out) Data associated with deleted tile.
dataSize - (out) Size of the data associated with deleted tile.
func (this *NavMesh) SetOffMeshConnectionCostModifier(ref NavMeshPolyRef, costOverride float32) NavMeshStatus

polyRef - polyRef of the offmeshlink polygon costOverride - use this as cost OffMeshLink cost modifier instead of what is specified by areas.

func (this *NavMesh) SetOffMeshConnectionFlags(ref NavMeshPolyRef, flags uint32) NavMeshStatus
func (this *NavMesh) SetOffMeshConnectionUserID(ref NavMeshPolyRef, userID int32) NavMeshStatus
func (this *NavMesh) SetSurfaceSettings(surfaceID int32, settings NavMeshBuildSettings)
func (this *NavMesh) UnconnectLinks(tile *NavMeshTile)

Removes all internal and external links from a tile.

func (this *NavMesh) UnconnectOffMeshConnection(index uint32)
func (this *NavMesh) UnconnectOffMeshConnectionsToTile(ref NavMeshTileRef)
type NavMeshBVNode struct {
	// contains filtered or unexported fields
}
type NavMeshBuildSettings struct {
	// contains filtered or unexported fields
}
type NavMeshData struct {
	// contains filtered or unexported fields
}

func NewDataFromFormat

func NewDataFromFormat(data *format.NavMeshData) *NavMeshData
func (this *NavMeshData) AddOffMeshLink(source, target Vector3f, area, linkDirection byte)
func (this *NavMeshData) GetAgentTypeId() int32
func (this *NavMeshData) GetFilterAreaCosts() []float32
func (this *NavMeshData) GetNavMeshBuildSettings() NavMeshBuildSettings
func (this *NavMeshData) GetNavMeshTiles() []NavMeshTileData
func (this *NavMeshData) GetOffMeshLinks() []AutoOffMeshLinkData
func (this *NavMeshData) GetPosition() Vector3f
func (this *NavMeshData) GetRotation() Quaternionf
type NavMeshDataHeader struct {
	// contains filtered or unexported fields
}
type NavMeshHit struct {
	// contains filtered or unexported fields
}
func (this *NavMeshHit) GetDistance() float32
func (this *NavMeshHit) GetMask() uint32
func (this *NavMeshHit) GetNormal() Vector3f
func (this *NavMeshHit) GetPosition() Vector3f
func (this *NavMeshHit) Hit() bool
type NavMeshLink struct {
	// contains filtered or unexported fields
}

Structure describing a link to another polygon.

type NavMeshLinkDirectionFlags int32
type NavMeshManager struct {
	// contains filtered or unexported fields
}

func NewManagerFromData

func NewManagerFromData(nvData *format.NavMeshData) (*NavMeshManager, error)

func NewNavMeshManager

func NewNavMeshManager() *NavMeshManager
func (this *NavMeshManager) CalculatePath(source, target Vector3f, maxIter int32) ([]Vector3f, bool)
func (this *NavMeshManager) CalculatePathCorners(corners []Vector3f, maxCorners int32, path *NavMeshPath) int32
func (this *NavMeshManager) CalculatePolygonPath(path *NavMeshPath, sourcePosition, targetPosition Vector3f, maxIter int32) int32
func (this *NavMeshManager) Clone() *NavMeshManager
func (this *NavMeshManager) DistanceToEdge(hit *NavMeshHit, sourcePosition Vector3f) bool
func (this *NavMeshManager) FindNearestPoly(center Vector3f, nearestRef *NavMeshPolyRef, nearestPt *Vector3f)
func (this *NavMeshManager) FindRandomPointInCircle(center Vector3f, radius float32) (Vector3f, error)
func (this *NavMeshManager) GetFilter() *QueryFilter
func (this *NavMeshManager) GetNavMesh() *NavMesh
func (this *NavMeshManager) GetNavMeshQuery() *NavMeshQuery
func (this *NavMeshManager) LoadData(nvData *NavMeshData) error
func (this *NavMeshManager) MapPosition(mappedPolyRef *NavMeshPolyRef, mappedPosition *Vector3f, position, extents Vector3f) bool
func (this *NavMeshManager) MoveAlongSurface(startRef NavMeshPolyRef, startPos Vector3f, endPos Vector3f, resultPos *Vector3f, visited []NavMeshPolyRef, visitedCount *int32, maxVisitedSize int32) NavMeshStatus
func (this *NavMeshManager) Raycast(hit *NavMeshHit, sourcePosition, targetPosition Vector3f) bool
func (this *NavMeshManager) SamplePosition(hit *NavMeshHit, sourcePosition Vector3f, maxDistance float32) bool
func (this *NavMeshManager) WalkableBetween(source, target Vector3f) bool

TODO not fully tested

type NavMeshNode struct {
	// contains filtered or unexported fields
}
type NavMeshNodeFlags uint8
type NavMeshNodeIndex uint16
type NavMeshNodePool struct {
	// contains filtered or unexported fields
}

func NewNavMeshNodePool

func NewNavMeshNodePool(maxNavMeshNodes, hashSize int32) *NavMeshNodePool

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

func (this *NavMeshNodePool) Clear()
func (this *NavMeshNodePool) FindNavMeshNode(id NavMeshPolyRef) *NavMeshNode
func (this *NavMeshNodePool) GetFirst(bucket int32) NavMeshNodeIndex
func (this *NavMeshNodePool) GetHashSize() int32
func (this *NavMeshNodePool) GetNext(i int32) NavMeshNodeIndex
func (this *NavMeshNodePool) GetNode(id NavMeshPolyRef) *NavMeshNode
func (this *NavMeshNodePool) GetNodeAtIdx(idx uint32) *NavMeshNode
func (this *NavMeshNodePool) GetNodeIdx(node *NavMeshNode) uint32
type NavMeshNodeQueue struct {
	// contains filtered or unexported fields
}

func NewNavMeshNodeQueue

func NewNavMeshNodeQueue(n int32) *NavMeshNodeQueue

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

func (this *NavMeshNodeQueue) BubbleUp(i int32, node *NavMeshNode)
func (this *NavMeshNodeQueue) Clear()
func (this *NavMeshNodeQueue) Modify(node *NavMeshNode)
func (this *NavMeshNodeQueue) Pop() *NavMeshNode
func (this *NavMeshNodeQueue) Push(node *NavMeshNode)
func (this *NavMeshNodeQueue) TrickleDown(i int32, node *NavMeshNode)
type NavMeshPath struct {
	// contains filtered or unexported fields
}

func NewNavMeshPath

func NewNavMeshPath() *NavMeshPath
func (this *NavMeshPath) GetPolygonCapacity() int32
func (this *NavMeshPath) GetPolygonCount() int32
func (this *NavMeshPath) GetPolygonData() []NavMeshPolyRef
func (this *NavMeshPath) GetPolygonPath() []NavMeshPolyRef
func (this *NavMeshPath) GetSourcePosition() Vector3f
func (this *NavMeshPath) GetStatus() NavMeshPathStatus
func (this *NavMeshPath) GetTargetPosition() Vector3f
func (this *NavMeshPath) IsComplete() bool
func (this *NavMeshPath) IsInvalid() bool
func (this *NavMeshPath) IsPartial() bool
func (this *NavMeshPath) ReservePolygons(size int32)
func (this *NavMeshPath) SetPolygonCount(polygonCount int32)
func (this *NavMeshPath) SetSourcePosition(sourcePosition Vector3f)
func (this *NavMeshPath) SetStatus(status NavMeshPathStatus)
func (this *NavMeshPath) SetTargetPosition(targetPosition Vector3f)
func (this *NavMeshPath) SetTimeStamp(timeStamp uint32)
type NavMeshPathStatus int32
type NavMeshPoly struct {
	// contains filtered or unexported fields
}

Structure describing the navigation polygon data.

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

Structure describing polygon detail triangles.

type NavMeshPolyDetailIndex uint16

The type for the detail mesh vertices index.

type NavMeshPolyRef uint64

Reference to navigation polygon.

func EncodeBasePolyId

func EncodeBasePolyId(typ uint32, ip uint32) NavMeshPolyRef

func EncodeLinkId

func EncodeLinkId(salt uint32, ip uint32) NavMeshPolyRef

func EncodePolyId

func EncodePolyId(salt uint32, it uint32, typ uint32, ip uint32) NavMeshPolyRef

Encodes a poly id.

type NavMeshPolyTypes int32

Flags describing polygon properties.

type NavMeshProcessCallback interface {
	ProcessPolygons(tile *NavMeshTile, polyRefs []NavMeshPolyRef, polys []*NavMeshPoly, itemCount int)
}
type NavMeshQuery struct {
	// contains filtered or unexported fields
}

func NewNavMeshQuery

func NewNavMeshQuery(navmesh *NavMesh, maxNodes int32) *NavMeshQuery
func (this *NavMeshQuery) ClosestPointOnPoly(ref NavMeshPolyRef, pos Vector3f, closest *Vector3f) NavMeshStatus

Returns closest point on navigation polygon. Uses detail polygons to find the closest point to the navigation polygon surface. Params:

ref - (in) ref to the polygon.
pos[3] - (in) the point to check.
closest[3] - (out) closest point.

Returns: true if closest point found.

func (this *NavMeshQuery) ClosestPointOnPolyBoundary(ref NavMeshPolyRef, pos Vector3f, closest *Vector3f) NavMeshStatus

Returns closest point on navigation polygon boundary. Uses the navigation polygon boundary to snap the point to poly boundary if it is outside the polygon. Much faster than ClosestPointToPoly. Does not affect height. Params:

ref - (in) ref to the polygon.
pos[3] - (in) the point to check.
closest[3] - (out) closest point.

Returns: true if closest point found.

func (this *NavMeshQuery) ClosestPointOnPolyInTileLocal(tile *NavMeshTile, poly *NavMeshPoly, ref NavMeshPolyRef,
	pos Vector3f, closest *Vector3f) bool

Local space input/output Calculate the closest point on a polygon Returns true unless the 2D projected point is outside the polygon

func (this *NavMeshQuery) FinalizeSlicedFindPath(pathCount *int32) NavMeshStatus

Finalizes sliced path find query and returns found path.

pathCount - (out) Number of polygons in search result.
func (this *NavMeshQuery) FinalizeSlicedFindPathPartial(pathCount *int32, existing []NavMeshPolyRef,
	existingSize int32) NavMeshStatus

Finalizes partial sliced path find query and returns path to the furthest polygon on the existing path that was visited during the search.

existing - (out) Array of polygons in the existing path.
existingSize - (out) Number of polygons in existing path array.
pathCount - (out) Number of polygons in search result.
func (this *NavMeshQuery) FindDistanceToWall(startRef NavMeshPolyRef, centerPos Vector3f,
	filter *QueryFilter, hitDist *float32, hitPos *Vector3f, hitNormal *Vector3f,
	hitFlags *uint32) NavMeshStatus

/ 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] 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.

func (this *NavMeshQuery) FindLocalNeighbourhood(startRef NavMeshPolyRef, centerPos Vector3f,
	radius float32, filter *QueryFilter, resultRef []NavMeshPolyRef, resultParent []NavMeshPolyRef,
	resultCount *int32, maxResult int32) NavMeshStatus

Finds non-overlapping local neighbourhood around center location. Note: The algorithm is optimized for small query radius and small number of polygons. Params:

startRef - (in) ref to the polygon where the search starts.
centerPos[3] - (in) center if the query circle.
radius - (in) radius of the query circle.
filter - (in) path polygon filter.
resultRef - (out) refs to the polygons touched by the circle.
resultParent - (out, opt) parent of each result polygon.
resultCount - (out) number of results.
maxResult - (int) maximum capacity of search results.
func (this *NavMeshQuery) FindNearestPoly(center Vector3f, extents Vector3f, filter *QueryFilter,
	nearestRef *NavMeshPolyRef, nearestPt *Vector3f)

Finds the nearest navigation polygon around the center location. Params:

center[3] - (in) The center of the search box.
extents[3] - (in) The extents of the search box.
filter - (in) path polygon filter.
nearestRef - (out) Reference to the nearest polygon.
nearestPt[3] - (out, opt) The nearest point on found polygon, null if not needed.
func (this *NavMeshQuery) FindStraightPath(startPos Vector3f, endPos Vector3f,
	path []NavMeshPolyRef, pathSize int32, straightPath []Vector3f,
	straightPathFlags []byte, straightPathRefs []NavMeshPolyRef,
	straightPathCount *int32, maxStraightPath int32) NavMeshStatus

Finds a straight path from start to end locations within the corridor described by the path polygons. Start and end locations will be clamped on the corridor. The returned polygon references are point to polygon which was entered when a path point was added. For the end point, zero will be returned. This allows to match for example off-mesh link points to their representative polygons. Params:

startPos[3] - (in) Path start location.
endPo[3] - (in) Path end location.
path - (in) Array of connected polygons describing the corridor.
pathSize - (in) Number of polygons in path array.
straightPath - (out) Points describing the straight path.
straightPathFlags - (out, opt) Flags describing each point type, see NavMeshStraightPathFlags.
straightPathRefs - (out, opt) References to polygons at point locations.
straightPathCount - (out) Number of points in the path.
maxStraightPath - (in) The max number of points the straight path array can hold. Must be at least 1
func (this *NavMeshQuery) GetAttachedNavMesh() *NavMesh
func (this *NavMeshQuery) GetPath(path []NavMeshPolyRef, pathCount *int32, maxPath int32) NavMeshStatus

Returns found path, must call finalizeSlicedFindPath() or finalizeSlicedFindPathPartial() before calling this function.

path - (out) array holding the search result.
pathCount - (out) Number of polygons in search result array.
maxPath - (in) The max number of polygons the path array can hold.
func (this *NavMeshQuery) GetPolyHeightLocal(ref NavMeshPolyRef, pos Vector3f, height *float32) NavMeshStatus

Returns height of the polygon at specified location. Params:

ref - (in) ref to the polygon.
pos[3] - (in) the point where to locate the height.
height - (out) height at the location.

Returns: true if over polygon.

func (this *NavMeshQuery) GetPolyWallSegments(ref NavMeshPolyRef, filter *QueryFilter,
	segmentVerts []Vector3f, segmentRefs []NavMeshPolyRef, segmentCount *int32, maxSegments int32) NavMeshStatus

Returns wall segments of specified polygon. If 'segmentRefs' is specified, both the wall and portal segments are returned. Wall segments will have null (0) polyref, and portal segments store the polygon they lead to. Params:

ref - (in) ref to the polygon.
filter - (in) path polygon filter.
segmentVerts[2*maxSegments] - (out) wall segments (2 endpoints per segment).
segmentRefs[maxSegments] - (out,opt) reference to a neighbour.
segmentCount - (out) number of wall segments.
maxSegments - (in) max number of segments that can be stored in 'segments'.
func (this *NavMeshQuery) GetPortalPoints(from NavMeshPolyRef, to NavMeshPolyRef, left *Vector3f, right *Vector3f) NavMeshStatus

Returns portal points between two polygons.

func (this *NavMeshQuery) GetUpAxis(ref NavMeshPolyRef, up *Vector3f) NavMeshStatus
func (this *NavMeshQuery) InitPools(nav *NavMesh, maxNodes int32) NavMeshStatus

Initializes the nav mesh query. Params:

nav - (in) pointer to navigation mesh data.
maxNodes - (in) Maximum number of search nodes to use (max 65536).
func (this *NavMeshQuery) InitSlicedFindPath(startRef NavMeshPolyRef, endRef NavMeshPolyRef, startPos Vector3f,
	endPos Vector3f, agentType int32, areaMask int32, costs [kAreaCount]float32) NavMeshStatus
func (this *NavMeshQuery) InitSlicedFindPath2(startRef NavMeshPolyRef, endRef NavMeshPolyRef, startPos Vector3f,
	endPos Vector3f, filter *QueryFilter) NavMeshStatus

Initializes sliced path find query. Note 1: calling any other NavMeshQuery method before calling FindPathEnd() may results in corrupted data! Note 2: The pointer to filter is store, and used in subsequent calls to UpdateSlicedFindPath(). Params:

startRef - (in) ref to path start polygon.
endRef - (in) ref to path end polygon.
startPos[3] - (in) Path start location.
endPos[3] - (in) Path end location.
filter - (in) path polygon filter.
func (this *NavMeshQuery) IsInClosedList(ref NavMeshPolyRef) bool

Returns true if poly reference ins in closed list.

func (this *NavMeshQuery) MoveAlongSurface(startRef NavMeshPolyRef, startPos Vector3f,
	endPos Vector3f, filter *QueryFilter, resultPos *Vector3f, visited []NavMeshPolyRef,
	visitedCount *int32, maxVisitedSize int32) NavMeshStatus

Moves from startPos to endPos constrained to the navmesh. If the endPos is reachable, the resultPos will be endPos, or else the resultPos will be the nearest point in navmesh. Note: The resulting point is not projected to the ground, use GetPolyHeight() to get height. Note: The algorithm is optimized for small delta movement and small number of polygons. Params:

startRef - (in) ref to the polygon where startPos lies.
startPos[3] - (in) start position of the mover.
endPos[3] - (in) desired end position of the mover.
filter - (in) path polygon filter.
resultPos[3] - (out) new position of the mover.
visited - (out) array of visited polygons.
visitedCount - (out) Number of entries in the visited array.
maxVisitedSize - (in) max number of polygons in the visited array.
func (this *NavMeshQuery) MoveAlongSurface2(startRef NavMeshPolyRef, startPos Vector3f,
	endPos Vector3f, filter *QueryFilter, resultPos *Vector3f, visited []NavMeshPolyRef,
	visitedCount *int32, maxVisitedSize int32, nodePool *NavMeshNodePool) NavMeshStatus
func (this *NavMeshQuery) ProjectToPoly(projPos *Vector3f, ref NavMeshPolyRef, pos Vector3f) NavMeshStatus

Project point to polygon along the local up-axis

func (this *NavMeshQuery) QueryPolygons(center Vector3f, extents Vector3f, filter *QueryFilter,
	polys []NavMeshPolyRef, polyCount *int32, maxPolys int32)

Returns polygons which overlap the query box. Params:

center[3] - (in) the center of the search box.
extents[3] - (in) the extents of the search box.
filter - (in) path polygon filter.
polys - (out) array holding the search result.
polyCount - (out) Number of polygons in search result array.
maxPolys - (in) The max number of polygons the polys array can hold.
func (this *NavMeshQuery) Raycast(startRef NavMeshPolyRef, startPos Vector3f, endPos Vector3f, filter *QueryFilter,
	result *NavMeshRaycastResult, path []NavMeshPolyRef, pathCount *int32, maxPath int32) NavMeshStatus

Casts 'walkability' ray along the navmesh surface from startPos towards the endPos. Params:

startRef - (in) ref to the polygon where the start lies.
startPos[3] - (in) start position of the query.
endPos[3] - (in) end position of the query.
filter - (in) path polygon filter.
result - (out) raycast result data.
path - (out,opt) visited path polygons.
pathCount - (out,opt) Number of polygons visited.
maxPath - (in) max number of polygons in the path array.
func (this *NavMeshQuery) RetracePortals(startIndex int32, endIndex int32,
	path []NavMeshPolyRef, n int32, termPos Vector3f, straightPath []Vector3f,
	straightPathFlags []byte, straightPathRefs []NavMeshPolyRef, maxStraightPath int32) int32

Retrace portals between corners register if type of polygon changes

func (this *NavMeshQuery) UpdateNeighbourLink(link *NavMeshLink, parentRef NavMeshPolyRef, bestRef NavMeshPolyRef, bestNode *NavMeshNode)
func (this *NavMeshQuery) UpdateSlicedFindPath(maxIter int32, doneIters *int32) NavMeshStatus

Updates sliced path find query. Params:

maxIter - (in) Max number of iterations to update.
doneIters - (out,opt) Number of iterations done during the update.

Returns: Path query state.

type NavMeshQueryData struct {
	// contains filtered or unexported fields
}
type NavMeshRaycastResult struct {
	// contains filtered or unexported fields
}
type NavMeshStatus uint32
type NavMeshStraightPathFlags int32

Flags returned by FindStraightPath().

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

func NewNavMeshTile

func NewNavMeshTile() *NavMeshTile
type NavMeshTileData struct {
	// contains filtered or unexported fields
}
func (this NavMeshTileData) GetData() []byte
type NavMeshTileFlags int32

Flags for addTile

type NavMeshTileRef uint64

Reference to navigation mesh tile.

type NearestQuery

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

func NewNearestQuery

func NewNearestQuery(navmesh *NavMesh, center Vector3f) NearestQuery

func (*NearestQuery) ProcessPolygons

func (this *NearestQuery) ProcessPolygons(tile *NavMeshTile, polyRefs []NavMeshPolyRef, polys []*NavMeshPoly, itemCount int)

type NearestQuery1

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

func NewNearestQuery1

func NewNearestQuery1(navMeshQuery *NavMeshQuery, filter *QueryFilter, center Vector3f) *NearestQuery1

func (*NearestQuery1) ProcessPolygons

func (this *NearestQuery1) ProcessPolygons(tile *NavMeshTile, polyRefs []NavMeshPolyRef, polys []*NavMeshPoly, itemCount int)

type OffMeshConnection

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

func NewOffMeshConnection

func NewOffMeshConnection() *OffMeshConnection

type OffMeshConnectionParams

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

type OffMeshFreeList

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

func (*OffMeshFreeList) Alloc

func (this *OffMeshFreeList) Alloc() uint32

func (*OffMeshFreeList) Capacity

func (this *OffMeshFreeList) Capacity() uint32

func (*OffMeshFreeList) Get

func (*OffMeshFreeList) Grow

func (this *OffMeshFreeList) Grow(s uint32)

func (*OffMeshFreeList) Init

func (this *OffMeshFreeList) Init()

func (*OffMeshFreeList) Release

func (this *OffMeshFreeList) Release(id uint32)

type OffMeshLinkEndPoint

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

type OverlapQuery

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

func NewOverlapQuery

func NewOverlapQuery(
	navmesh *NavMesh, start Vector3f, end Vector3f, height float32, polys []NavMeshPolyRef, overlapMinMax []float32, maxPolys int) OverlapQuery

func (*OverlapQuery) ProcessPolygons

func (this *OverlapQuery) ProcessPolygons(tile *NavMeshTile, polyRefs []NavMeshPolyRef, polys []*NavMeshPoly, itemCount int)

type PathCorridor

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

func NewPathCorridor

func NewPathCorridor() *PathCorridor

func (*PathCorridor) ClearPath

func (this *PathCorridor) ClearPath()

func (*PathCorridor) FindCorners

func (this *PathCorridor) FindCorners(cornerVerts []Vector3f, cornerFlags []uint8,
	cornerPolys []NavMeshPolyRef, cornerCount *int32, maxCorners int32,
	navquery *NavMeshQuery) NavMeshStatus

func (*PathCorridor) GetCurrentPos

func (this *PathCorridor) GetCurrentPos() Vector3f

func (*PathCorridor) GetLastPoly

func (this *PathCorridor) GetLastPoly() NavMeshPolyRef

func (*PathCorridor) GetPath

func (this *PathCorridor) GetPath() []NavMeshPolyRef

func (*PathCorridor) GetPathCount

func (this *PathCorridor) GetPathCount() int32

func (*PathCorridor) Invalidate

func (this *PathCorridor) Invalidate()

func (*PathCorridor) MoveOverOffmeshConnection

func (this *PathCorridor) MoveOverOffmeshConnection(offMeshConRef NavMeshPolyRef, currentPos Vector3f,
	startPos Vector3f, endPos Vector3f, navquery *NavMeshQuery) bool

func (*PathCorridor) MovePosition

func (this *PathCorridor) MovePosition(newPos Vector3f, navquery *NavMeshQuery, filter *QueryFilter) bool

func (*PathCorridor) OptimizePathTopology

func (this *PathCorridor) OptimizePathTopology(navquery *NavMeshQuery, filter *QueryFilter) bool

func (*PathCorridor) OptimizePathVisibility

func (this *PathCorridor) OptimizePathVisibility(next Vector3f, navquery *NavMeshQuery, filter *QueryFilter)

func (*PathCorridor) Reset

func (this *PathCorridor) Reset(ref NavMeshPolyRef, pos Vector3f)

func (*PathCorridor) SetCorridor

func (this *PathCorridor) SetCorridor(target Vector3f, navquery *NavMeshQuery, path []NavMeshPolyRef, npath int32, partialPath bool)

func (*PathCorridor) SetPathInterrupted

func (this *PathCorridor) SetPathInterrupted(inbool bool)

func (*PathCorridor) SetPathPartial

func (this *PathCorridor) SetPathPartial(inbool bool)

func (*PathCorridor) SetPathValid

func (this *PathCorridor) SetPathValid(inbool bool)

func (*PathCorridor) SetStateFlag

func (this *PathCorridor) SetStateFlag(setFlag bool, stateFlag PathCorridorState)

func (*PathCorridor) SetToEnd

func (this *PathCorridor) SetToEnd()

func (*PathCorridor) UpdateTargetPosition

func (this *PathCorridor) UpdateTargetPosition(ref NavMeshPolyRef, target Vector3f) bool

type PathCorridorState

type PathCorridorState uint8

type PolygonQuery

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

func NewPolygonQuery

func NewPolygonQuery(query *NavMeshQuery, filter *QueryFilter, polys []NavMeshPolyRef, maxPolys int32) *PolygonQuery

func (*PolygonQuery) ProcessPolygons

func (this *PolygonQuery) ProcessPolygons(title *NavMeshTile, polyRefs []NavMeshPolyRef, polys []*NavMeshPoly, itemCount int)

type PortalArea

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

type Quaternionf

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

func InverseQuaternion

func InverseQuaternion(q Quaternionf) Quaternionf

func (*Quaternionf) Add

func (this *Quaternionf) Add(that Quaternionf) Quaternionf

func (*Quaternionf) Sub

func (this *Quaternionf) Sub(that Quaternionf) Quaternionf

type QueryFilter

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

func NewQueryFilter

func NewQueryFilter() *QueryFilter

func (*QueryFilter) GetAreaCost

func (this *QueryFilter) GetAreaCost(i int32) float32

Getters and setters for the default implementation data.

func (*QueryFilter) GetIncludeFlags

func (this *QueryFilter) GetIncludeFlags() uint32

func (*QueryFilter) GetTypeID

func (this *QueryFilter) GetTypeID() int32

func (*QueryFilter) PassFilter

func (this *QueryFilter) PassFilter(flags uint32) bool

func (*QueryFilter) Set

func (this *QueryFilter) Set(typeID int32, includeFlags uint32, costs []float32)

func (*QueryFilter) SetAreaCost

func (this *QueryFilter) SetAreaCost(i int32, cost float32)

func (*QueryFilter) SetAreaCosts

func (this *QueryFilter) SetAreaCosts(areaCosts []float32)

func (*QueryFilter) SetIncludeFlags

func (this *QueryFilter) SetIncludeFlags(flags uint32)

func (*QueryFilter) SetTypeID

func (this *QueryFilter) SetTypeID(typeID int32)

type SegInterval

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

type SurfaceData

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

func NewSurfaceData

func NewSurfaceData() *SurfaceData

type TileFreeList

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

func (*TileFreeList) Alloc

func (this *TileFreeList) Alloc() uint32

func (*TileFreeList) Capacity

func (this *TileFreeList) Capacity() uint32

func (*TileFreeList) Get

func (this *TileFreeList) Get(i uint32) *NavMeshTile

func (*TileFreeList) Grow

func (this *TileFreeList) Grow(s uint32)

func (*TileFreeList) Init

func (this *TileFreeList) Init()

func (*TileFreeList) Release

func (this *TileFreeList) Release(id uint32)

type TileLoc

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

type Vector2f

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

type Vector3f

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

func ClosestPtPointTriangle

func ClosestPtPointTriangle(p Vector3f, a Vector3f, b Vector3f, c Vector3f) Vector3f

It's assumed the triangle (a,b,c) is not degenerate - otherwise division by zero might occur

func Cross

func Cross(lhs, rhs Vector3f) Vector3f

func LerpVector3f

func LerpVector3f(from, to Vector3f, t float32) Vector3f

func MaxVector3f

func MaxVector3f(l, r Vector3f) Vector3f

func MinVector3f

func MinVector3f(l, r Vector3f) Vector3f

func NewVector3f

func NewVector3f(x, y, z float32) Vector3f

func Normalize

func Normalize(inV Vector3f) Vector3f

func NormalizeSafe

func NormalizeSafe(inV, defaultV Vector3f) Vector3f

func RandomPointInConvexPoly

func RandomPointInConvexPoly(pts []Vector3f, npts int) Vector3f

Returns a random point in a convex polygon. Adapted from Graphics Gems article.

func RotateExtents

func RotateExtents(extents Vector3f, rotation Matrix3x3f) Vector3f

func RotateVectorByQuat

func RotateVectorByQuat(lhs Quaternionf, rhs Vector3f) Vector3f

func SegmentSegmentCPA

func SegmentSegmentCPA(p0 Vector3f, p1 Vector3f, q0 Vector3f, q1 Vector3f) Vector3f

returns the Closest Point of Approach (CPA) on segment p for two line segments (p,q). note: returns segment midpoint in the degenerate case.

func TileToWorld

func TileToWorld(tile *NavMeshTile, position Vector3f) Vector3f

func TileToWorldSafe

func TileToWorldSafe(tile *NavMeshTile, p Vector3f) Vector3f

func TileToWorldVector

func TileToWorldVector(tile *NavMeshTile, direction Vector3f) Vector3f

func WorldToTile

func WorldToTile(tile *NavMeshTile, position Vector3f) Vector3f

func WorldToTileSafe

func WorldToTileSafe(tile *NavMeshTile, p Vector3f) Vector3f

func (Vector3f) Add

func (this Vector3f) Add(data Vector3f) Vector3f

func (Vector3f) Div

func (this Vector3f) Div(v float32) Vector3f

func (*Vector3f) GetData

func (this *Vector3f) GetData(i int) float32

func (Vector3f) Mulf

func (this Vector3f) Mulf(data float32) Vector3f

func (Vector3f) Mulv

func (this Vector3f) Mulv(data Vector3f) Vector3f

func (Vector3f) Neg

func (this Vector3f) Neg() Vector3f

func (*Vector3f) Set

func (this *Vector3f) Set(x, y, z float32)

func (*Vector3f) SetData

func (this *Vector3f) SetData(i int, data float32)

func (*Vector3f) SetZero

func (this *Vector3f) SetZero()

func (Vector3f) Sub

func (this Vector3f) Sub(data Vector3f) Vector3f

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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