Documentation ¶
Overview ¶
Package NavigationPolygon provides methods for working with NavigationPolygon object instances.
Index ¶
- type Advanced
- type Any
- type Instance
- func (self Instance) AddOutline(outline []Vector2.XY)
- func (self Instance) AddOutlineAtIndex(outline []Vector2.XY, index int)
- func (self Instance) AddPolygon(polygon []int32)
- func (self Instance) AgentRadius() Float.X
- func (self Instance) AsNavigationPolygon() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) BakingRect() Rect2.PositionSize
- func (self Instance) BakingRectOffset() Vector2.XY
- func (self Instance) BorderSize() Float.X
- func (self Instance) CellSize() Float.X
- func (self Instance) Clear()
- func (self Instance) ClearOutlines()
- func (self Instance) ClearPolygons()
- func (self Instance) GetNavigationMesh() [1]gdclass.NavigationMesh
- func (self Instance) GetOutline(idx int) []Vector2.XY
- func (self Instance) GetOutlineCount() int
- func (self Instance) GetParsedCollisionMaskValue(layer_number int) bool
- func (self Instance) GetPolygon(idx int) []int32
- func (self Instance) GetPolygonCount() int
- func (self Instance) MakePolygonsFromOutlines()
- func (self Instance) ParsedCollisionMask() int
- func (self Instance) ParsedGeometryType() gdclass.NavigationPolygonParsedGeometryType
- func (self Instance) RemoveOutline(idx int)
- func (self Instance) SetAgentRadius(value Float.X)
- func (self Instance) SetBakingRect(value Rect2.PositionSize)
- func (self Instance) SetBakingRectOffset(value Vector2.XY)
- func (self Instance) SetBorderSize(value Float.X)
- func (self Instance) SetCellSize(value Float.X)
- func (self Instance) SetOutline(idx int, outline []Vector2.XY)
- func (self Instance) SetParsedCollisionMask(value int)
- func (self Instance) SetParsedCollisionMaskValue(layer_number int, value bool)
- func (self Instance) SetParsedGeometryType(value gdclass.NavigationPolygonParsedGeometryType)
- func (self Instance) SetSourceGeometryGroupName(value string)
- func (self Instance) SetSourceGeometryMode(value gdclass.NavigationPolygonSourceGeometryMode)
- func (self Instance) SetVertices(value []Vector2.XY)
- func (self Instance) SourceGeometryGroupName() string
- func (self Instance) SourceGeometryMode() gdclass.NavigationPolygonSourceGeometryMode
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Vertices() []Vector2.XY
- func (self Instance) Virtual(name string) reflect.Value
- type ParsedGeometryType
- type SourceGeometryMode
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 Instance ¶
type Instance [1]gdclass.NavigationPolygon
A navigation mesh can be created either by baking it with the help of the [NavigationServer2D], or by adding vertices and convex polygon indices arrays manually. To bake a navigation mesh at least one outline needs to be added that defines the outer bounds of the baked area. [codeblocks] [gdscript] var new_navigation_mesh = NavigationPolygon.new() var bounding_outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) new_navigation_mesh.add_outline(bounding_outline) NavigationServer2D.bake_from_source_geometry_data(new_navigation_mesh, NavigationMeshSourceGeometryData2D.new()); $NavigationRegion2D.navigation_polygon = new_navigation_mesh [/gdscript] [csharp] var newNavigationMesh = new NavigationPolygon(); var boundingOutline = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) }; newNavigationMesh.AddOutline(boundingOutline); NavigationServer2D.BakeFromSourceGeometryData(newNavigationMesh, new NavigationMeshSourceGeometryData2D()); GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh; [/csharp] [/codeblocks] Adding vertices and polygon indices manually. [codeblocks] [gdscript] var new_navigation_mesh = NavigationPolygon.new() var new_vertices = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) new_navigation_mesh.vertices = new_vertices var new_polygon_indices = PackedInt32Array([0, 1, 2, 3]) new_navigation_mesh.add_polygon(new_polygon_indices) $NavigationRegion2D.navigation_polygon = new_navigation_mesh [/gdscript] [csharp] var newNavigationMesh = new NavigationPolygon(); var newVertices = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) }; newNavigationMesh.Vertices = newVertices; var newPolygonIndices = new int[] { 0, 1, 2, 3 }; newNavigationMesh.AddPolygon(newPolygonIndices); GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh; [/csharp] [/codeblocks]
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddOutline ¶
Appends a [PackedVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines.
func (Instance) AddOutlineAtIndex ¶
Adds a [PackedVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position.
func (Instance) AddPolygon ¶
Adds a polygon using the indices of the vertices you get when calling [method get_vertices].
func (Instance) AgentRadius ¶
func (Instance) AsNavigationPolygon ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) BakingRect ¶
func (self Instance) BakingRect() Rect2.PositionSize
func (Instance) BakingRectOffset ¶
func (Instance) BorderSize ¶
func (Instance) Clear ¶
func (self Instance) Clear()
Clears the internal arrays for vertices and polygon indices.
func (Instance) ClearOutlines ¶
func (self Instance) ClearOutlines()
Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them.
func (Instance) ClearPolygons ¶
func (self Instance) ClearPolygons()
Clears the array of polygons, but it doesn't clear the array of outlines and vertices.
func (Instance) GetNavigationMesh ¶
func (self Instance) GetNavigationMesh() [1]gdclass.NavigationMesh
Returns the [NavigationMesh] resulting from this navigation polygon. This navigation mesh can be used to update the navigation mesh of a region with the [method NavigationServer3D.region_set_navigation_mesh] API directly (as 2D uses the 3D server behind the scene).
func (Instance) GetOutline ¶
Returns a [PackedVector2Array] containing the vertices of an outline that was created in the editor or by script.
func (Instance) GetOutlineCount ¶
Returns the number of outlines that were created in the editor or by script.
func (Instance) GetParsedCollisionMaskValue ¶
Returns whether or not the specified layer of the [member parsed_collision_mask] is enabled, given a [param layer_number] between 1 and 32.
func (Instance) GetPolygon ¶
Returns a [PackedInt32Array] containing the indices of the vertices of a created polygon.
func (Instance) GetPolygonCount ¶
Returns the count of all polygons.
func (Instance) MakePolygonsFromOutlines ¶
func (self Instance) MakePolygonsFromOutlines()
Creates polygons from the outlines added in the editor or by script.
func (Instance) ParsedCollisionMask ¶
func (Instance) ParsedGeometryType ¶
func (self Instance) ParsedGeometryType() gdclass.NavigationPolygonParsedGeometryType
func (Instance) RemoveOutline ¶
Removes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update.
func (Instance) SetAgentRadius ¶
func (Instance) SetBakingRect ¶
func (self Instance) SetBakingRect(value Rect2.PositionSize)
func (Instance) SetBakingRectOffset ¶
func (Instance) SetBorderSize ¶
func (Instance) SetCellSize ¶
func (Instance) SetOutline ¶
Changes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update.
func (Instance) SetParsedCollisionMask ¶
func (Instance) SetParsedCollisionMaskValue ¶
Based on [param value], enables or disables the specified layer in the [member parsed_collision_mask], given a [param layer_number] between 1 and 32.
func (Instance) SetParsedGeometryType ¶
func (self Instance) SetParsedGeometryType(value gdclass.NavigationPolygonParsedGeometryType)
func (Instance) SetSourceGeometryGroupName ¶
func (Instance) SetSourceGeometryMode ¶
func (self Instance) SetSourceGeometryMode(value gdclass.NavigationPolygonSourceGeometryMode)
func (Instance) SetVertices ¶
func (Instance) SourceGeometryGroupName ¶
func (Instance) SourceGeometryMode ¶
func (self Instance) SourceGeometryMode() gdclass.NavigationPolygonSourceGeometryMode
func (*Instance) UnsafePointer ¶
type ParsedGeometryType ¶
type ParsedGeometryType = gdclass.NavigationPolygonParsedGeometryType //gd:NavigationPolygon.ParsedGeometryType
const ( /*Parses mesh instances as obstruction geometry. This includes [Polygon2D], [MeshInstance2D], [MultiMeshInstance2D], and [TileMap] nodes. Meshes are only parsed when they use a 2D vertices surface format.*/ ParsedGeometryMeshInstances ParsedGeometryType = 0 /*Parses [StaticBody2D] and [TileMap] colliders as obstruction geometry. The collider should be in any of the layers specified by [member parsed_collision_mask].*/ ParsedGeometryStaticColliders ParsedGeometryType = 1 /*Both [constant PARSED_GEOMETRY_MESH_INSTANCES] and [constant PARSED_GEOMETRY_STATIC_COLLIDERS].*/ ParsedGeometryBoth ParsedGeometryType = 2 /*Represents the size of the [enum ParsedGeometryType] enum.*/ ParsedGeometryMax ParsedGeometryType = 3 )
type SourceGeometryMode ¶
type SourceGeometryMode = gdclass.NavigationPolygonSourceGeometryMode //gd:NavigationPolygon.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 [member source_geometry_group_name].*/ SourceGeometryGroupsWithChildren SourceGeometryMode = 1 /*Uses nodes in a group for geometry. The group is specified by [member source_geometry_group_name].*/ SourceGeometryGroupsExplicit SourceGeometryMode = 2 /*Represents the size of the [enum SourceGeometryMode] enum.*/ SourceGeometryMax SourceGeometryMode = 3 )