NavigationMesh

package
v0.0.0-...-357ca8a Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

A navigation mesh is a collection of polygons that define which areas of an environment are traversable to aid agents in pathfinding through complicated spaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsNavigationMesh() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsNavigationMesh

func (self *Extension[T]) AsNavigationMesh() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.NavigationMesh

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddPolygon

func (self Instance) AddPolygon(polygon []int32)

Adds a polygon using the indices of the vertices you get when calling GetVertices.

func (Instance) AgentHeight

func (self Instance) AgentHeight() Float.X

The minimum floor to ceiling height that will still allow the floor area to be considered walkable.

Note: While baking, this value will be rounded up to the nearest multiple of CellHeight.

func (Instance) AgentMaxClimb

func (self Instance) AgentMaxClimb() Float.X

The minimum ledge height that is considered to still be traversable.

Note: While baking, this value will be rounded down to the nearest multiple of CellHeight.

func (Instance) AgentMaxSlope

func (self Instance) AgentMaxSlope() Float.X

The maximum slope that is considered walkable, in degrees.

func (Instance) AgentRadius

func (self Instance) AgentRadius() Float.X

The distance to erode/shrink the walkable area of the heightfield away from obstructions.

Note: While baking, this value will be rounded up to the nearest multiple of CellSize.

Note: The radius must be equal or higher than 0.0. If the radius is 0.0, it won't be possible to fix invalid outline overlaps and other precision errors during the baking process. As a result, some obstacles may be excluded incorrectly from the final navigation mesh, or may delete the navigation mesh's polygons.

func (Instance) AsNavigationMesh

func (self Instance) AsNavigationMesh() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) BorderSize

func (self Instance) BorderSize() Float.X

The size of the non-navigable border around the bake bounding area.

In conjunction with the FilterBakingAabb and a EdgeMaxError value at 1.0 or below the border size can be used to bake tile aligned navigation meshes without the tile edges being shrunk by AgentRadius.

Note: If this value is not 0.0, it will be rounded up to the nearest multiple of CellSize during baking.

func (Instance) CellHeight

func (self Instance) CellHeight() Float.X

The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map.

func (Instance) CellSize

func (self Instance) CellSize() Float.X

The cell size used to rasterize the navigation mesh vertices on the XZ plane. Must match with the cell size on the navigation map.

func (Instance) Clear

func (self Instance) Clear()

Clears the internal arrays for vertices and polygon indices.

func (Instance) ClearPolygons

func (self Instance) ClearPolygons()

Clears the array of polygons, but it doesn't clear the array of vertices.

func (Instance) CreateFromMesh

func (self Instance) CreateFromMesh(mesh Mesh.Instance)

Initializes the navigation mesh by setting the vertices and indices according to a Mesh.

Note: The given 'mesh' must be of type [Mesh.PrimitiveTriangles] and have an index array.

func (Instance) DetailSampleDistance

func (self Instance) DetailSampleDistance() Float.X

The sampling distance to use when generating the detail mesh, in cell unit.

func (Instance) DetailSampleMaxError

func (self Instance) DetailSampleMaxError() Float.X

The maximum distance the detail mesh surface should deviate from heightfield, in cell unit.

func (Instance) EdgeMaxError

func (self Instance) EdgeMaxError() Float.X

The maximum distance a simplified contour's border edges should deviate the original raw contour.

func (Instance) EdgeMaxLength

func (self Instance) EdgeMaxLength() Float.X

The maximum allowed length for contour edges along the border of the mesh. A value of 0.0 disables this feature.

Note: While baking, this value will be rounded up to the nearest multiple of CellSize.

func (Instance) FilterBakingAabb

func (self Instance) FilterBakingAabb() AABB.PositionSize

If the baking AABB.PositionSize has a volume the navigation mesh baking will be restricted to its enclosing area.

func (Instance) FilterBakingAabbOffset

func (self Instance) FilterBakingAabbOffset() Vector3.XYZ

The position offset applied to the FilterBakingAabb AABB.PositionSize.

func (Instance) FilterLedgeSpans

func (self Instance) FilterLedgeSpans() bool

If true, marks spans that are ledges as non-walkable.

func (Instance) FilterLowHangingObstacles

func (self Instance) FilterLowHangingObstacles() bool

If true, marks non-walkable spans as walkable if their maximum is within AgentMaxClimb of a walkable neighbor.

func (Instance) FilterWalkableLowHeightSpans

func (self Instance) FilterWalkableLowHeightSpans() bool

If true, marks walkable spans as not walkable if the clearance above the span is less than AgentHeight.

func (Instance) GeometryCollisionMask

func (self Instance) GeometryCollisionMask() int

The physics layers to scan for static colliders.

Only used when GeometryParsedGeometryType is ParsedGeometryStaticColliders or ParsedGeometryBoth.

func (Instance) GeometryParsedGeometryType

func (self Instance) GeometryParsedGeometryType() ParsedGeometryType

Determines which type of nodes will be parsed as geometry.

func (Instance) GeometrySourceGeometryMode

func (self Instance) GeometrySourceGeometryMode() SourceGeometryMode

The source of the geometry used when baking.

func (Instance) GeometrySourceGroupName

func (self Instance) GeometrySourceGroupName() string

The name of the group to scan for geometry.

Only used when GeometrySourceGeometryMode is SourceGeometryGroupsWithChildren or SourceGeometryGroupsExplicit.

func (Instance) GetCollisionMaskValue

func (self Instance) GetCollisionMaskValue(layer_number int) bool

Returns whether or not the specified layer of the GeometryCollisionMask is enabled, given a 'layer_number' between 1 and 32.

func (Instance) GetPolygon

func (self Instance) GetPolygon(idx int) []int32

Returns a []int32 containing the indices of the vertices of a created polygon.

func (Instance) GetPolygonCount

func (self Instance) GetPolygonCount() int

Returns the number of polygons in the navigation mesh.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) RegionMergeSize

func (self Instance) RegionMergeSize() Float.X

Any regions with a size smaller than this will be merged with larger regions if possible.

Note: This value will be squared to calculate the number of cells. For example, a value of 20 will set the number of cells to 400.

func (Instance) RegionMinSize

func (self Instance) RegionMinSize() Float.X

The minimum size of a region for it to be created.

Note: This value will be squared to calculate the minimum number of cells allowed to form isolated island areas. For example, a value of 8 will set the number of cells to 64.

func (Instance) SamplePartitionType

func (self Instance) SamplePartitionType() SamplePartitionType

Partitioning algorithm for creating the navigation mesh polys.

func (Instance) SetAgentHeight

func (self Instance) SetAgentHeight(value Float.X)

SetAgentHeight sets the property returned by [GetAgentHeight].

func (Instance) SetAgentMaxClimb

func (self Instance) SetAgentMaxClimb(value Float.X)

SetAgentMaxClimb sets the property returned by [GetAgentMaxClimb].

func (Instance) SetAgentMaxSlope

func (self Instance) SetAgentMaxSlope(value Float.X)

SetAgentMaxSlope sets the property returned by [GetAgentMaxSlope].

func (Instance) SetAgentRadius

func (self Instance) SetAgentRadius(value Float.X)

SetAgentRadius sets the property returned by [GetAgentRadius].

func (Instance) SetBorderSize

func (self Instance) SetBorderSize(value Float.X)

SetBorderSize sets the property returned by [GetBorderSize].

func (Instance) SetCellHeight

func (self Instance) SetCellHeight(value Float.X)

SetCellHeight sets the property returned by [GetCellHeight].

func (Instance) SetCellSize

func (self Instance) SetCellSize(value Float.X)

SetCellSize sets the property returned by [GetCellSize].

func (Instance) SetCollisionMaskValue

func (self Instance) SetCollisionMaskValue(layer_number int, value bool)

Based on 'value', enables or disables the specified layer in the GeometryCollisionMask, given a 'layer_number' between 1 and 32.

func (Instance) SetDetailSampleDistance

func (self Instance) SetDetailSampleDistance(value Float.X)

SetDetailSampleDistance sets the property returned by [GetDetailSampleDistance].

func (Instance) SetDetailSampleMaxError

func (self Instance) SetDetailSampleMaxError(value Float.X)

SetDetailSampleMaxError sets the property returned by [GetDetailSampleMaxError].

func (Instance) SetEdgeMaxError

func (self Instance) SetEdgeMaxError(value Float.X)

SetEdgeMaxError sets the property returned by [GetEdgeMaxError].

func (Instance) SetEdgeMaxLength

func (self Instance) SetEdgeMaxLength(value Float.X)

SetEdgeMaxLength sets the property returned by [GetEdgeMaxLength].

func (Instance) SetFilterBakingAabb

func (self Instance) SetFilterBakingAabb(value AABB.PositionSize)

SetFilterBakingAabb sets the property returned by [GetFilterBakingAabb].

func (Instance) SetFilterBakingAabbOffset

func (self Instance) SetFilterBakingAabbOffset(value Vector3.XYZ)

SetFilterBakingAabbOffset sets the property returned by [GetFilterBakingAabbOffset].

func (Instance) SetFilterLedgeSpans

func (self Instance) SetFilterLedgeSpans(value bool)

SetFilterLedgeSpans sets the property returned by [GetFilterLedgeSpans].

func (Instance) SetFilterLowHangingObstacles

func (self Instance) SetFilterLowHangingObstacles(value bool)

SetFilterLowHangingObstacles sets the property returned by [GetFilterLowHangingObstacles].

func (Instance) SetFilterWalkableLowHeightSpans

func (self Instance) SetFilterWalkableLowHeightSpans(value bool)

SetFilterWalkableLowHeightSpans sets the property returned by [GetFilterWalkableLowHeightSpans].

func (Instance) SetGeometryCollisionMask

func (self Instance) SetGeometryCollisionMask(value int)

SetGeometryCollisionMask sets the property returned by [GetCollisionMask].

func (Instance) SetGeometryParsedGeometryType

func (self Instance) SetGeometryParsedGeometryType(value ParsedGeometryType)

SetGeometryParsedGeometryType sets the property returned by [GetParsedGeometryType].

func (Instance) SetGeometrySourceGeometryMode

func (self Instance) SetGeometrySourceGeometryMode(value SourceGeometryMode)

SetGeometrySourceGeometryMode sets the property returned by [GetSourceGeometryMode].

func (Instance) SetGeometrySourceGroupName

func (self Instance) SetGeometrySourceGroupName(value string)

SetGeometrySourceGroupName sets the property returned by [GetSourceGroupName].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetRegionMergeSize

func (self Instance) SetRegionMergeSize(value Float.X)

SetRegionMergeSize sets the property returned by [GetRegionMergeSize].

func (Instance) SetRegionMinSize

func (self Instance) SetRegionMinSize(value Float.X)

SetRegionMinSize sets the property returned by [GetRegionMinSize].

func (Instance) SetSamplePartitionType

func (self Instance) SetSamplePartitionType(value SamplePartitionType)

SetSamplePartitionType sets the property returned by [GetSamplePartitionType].

func (Instance) SetVertices

func (self Instance) SetVertices(value []Vector3.XYZ)

SetVertices sets the property returned by [GetVertices].

func (Instance) SetVerticesPerPolygon

func (self Instance) SetVerticesPerPolygon(value Float.X)

SetVerticesPerPolygon sets the property returned by [GetVerticesPerPolygon].

func (Instance) Vertices

func (self Instance) Vertices() []Vector3.XYZ

func (Instance) VerticesPerPolygon

func (self Instance) VerticesPerPolygon() Float.X

The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type ParsedGeometryType

type ParsedGeometryType int //gd:NavigationMesh.ParsedGeometryType
const (
	// Parses mesh instances as geometry. This includes [MeshInstance3D], [CSGShape3D], and [GridMap] nodes.
	//
	// [CSGShape3D]: https://pkg.go.dev/graphics.gd/classdb/CSGShape3D
	// [GridMap]: https://pkg.go.dev/graphics.gd/classdb/GridMap
	// [MeshInstance3D]: https://pkg.go.dev/graphics.gd/classdb/MeshInstance3D
	ParsedGeometryMeshInstances ParsedGeometryType = 0
	// Parses [StaticBody3D] colliders as geometry. The collider should be in any of the layers specified by [GeometryCollisionMask].
	//
	// [GeometryCollisionMask]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GeometryCollisionMask
	// [StaticBody3D]: https://pkg.go.dev/graphics.gd/classdb/StaticBody3D
	ParsedGeometryStaticColliders ParsedGeometryType = 1
	// Both [ParsedGeometryMeshInstances] and [ParsedGeometryStaticColliders].
	ParsedGeometryBoth ParsedGeometryType = 2
	// Represents the size of the [ParsedGeometryType] enum.
	ParsedGeometryMax ParsedGeometryType = 3
)

type SamplePartitionType

type SamplePartitionType int //gd:NavigationMesh.SamplePartitionType
const (
	// Watershed partitioning. Generally the best choice if you precompute the navigation mesh, use this if you have large open areas.
	SamplePartitionWatershed SamplePartitionType = 0
	// Monotone partitioning. Use this if you want fast navigation mesh generation.
	SamplePartitionMonotone SamplePartitionType = 1
	// Layer partitioning. Good choice to use for tiled navigation mesh with medium and small sized tiles.
	SamplePartitionLayers SamplePartitionType = 2
	// Represents the size of the [SamplePartitionType] enum.
	SamplePartitionMax SamplePartitionType = 3
)

type SourceGeometryMode

type SourceGeometryMode int //gd:NavigationMesh.SourceGeometryMode
const (
	// Scans the child nodes of the root node recursively for geometry.
	SourceGeometryRootNodeChildren SourceGeometryMode = 0
	// Scans nodes in a group and their child nodes recursively for geometry. The group is specified by [GeometrySourceGroupName].
	//
	// [GeometrySourceGroupName]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GeometrySourceGroupName
	SourceGeometryGroupsWithChildren SourceGeometryMode = 1
	// Uses nodes in a group for geometry. The group is specified by [GeometrySourceGroupName].
	//
	// [GeometrySourceGroupName]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GeometrySourceGroupName
	SourceGeometryGroupsExplicit SourceGeometryMode = 2
	// Represents the size of the [SourceGeometryMode] enum.
	SourceGeometryMax SourceGeometryMode = 3
)

Jump to

Keyboard shortcuts

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