NavigationPolygon

A node that has methods to draw outlines or use indices of vertices to create navigation polygons.

There are two ways to create polygons. Either by using the addOutline method, or using the addPolygon method. Using addOutline:

More...

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

_getOutlines
Array _getOutlines()
_getPolygons
Array _getPolygons()
_setOutlines
void _setOutlines(Array outlines)
_setPolygons
void _setPolygons(Array polygons)
addOutline
void addOutline(PoolVector2Array outline)

Appends a PoolVector2Array that contains the vertices of an outline to the internal array that contains all the outlines. You have to call makePolygonsFromOutlines in order for this array to be converted to polygons that the engine will use.

addOutlineAtIndex
void addOutlineAtIndex(PoolVector2Array outline, long index)

Adds a PoolVector2Array that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position. You have to call makePolygonsFromOutlines in order for this array to be converted to polygons that the engine will use.

addPolygon
void addPolygon(PoolIntArray polygon)

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

clearOutlines
void clearOutlines()

Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them.

clearPolygons
void clearPolygons()

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

getOutline
PoolVector2Array getOutline(long idx)

Returns a PoolVector2Array containing the vertices of an outline that was created in the editor or by script.

getOutlineCount
long getOutlineCount()

Returns the number of outlines that were created in the editor or by script.

getPolygon
PoolIntArray getPolygon(long idx)

Returns a PoolIntArray containing the indices of the vertices of a created polygon.

getPolygonCount
long getPolygonCount()

Returns the count of all polygons.

getVertices
PoolVector2Array getVertices()

Returns a PoolVector2Array containing all the vertices being used to create the polygons.

makePolygonsFromOutlines
void makePolygonsFromOutlines()

Creates polygons from the outlines added in the editor or by script.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(NavigationPolygon other)
opEquals
bool opEquals(typeof(null) n)
removeOutline
void removeOutline(long idx)

Removes an outline created in the editor or by script. You have to call makePolygonsFromOutlines for the polygons to update.

setOutline
void setOutline(long idx, PoolVector2Array outline)

Changes an outline created in the editor or by script. You have to call makePolygonsFromOutlines for the polygons to update.

setVertices
void setVertices(PoolVector2Array vertices)

Sets the vertices that can be then indexed to create polygons with the addPolygon method.

toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

outlines
Array outlines [@property getter]
Array outlines [@property setter]
polygons
Array polygons [@property getter]
Array polygons [@property setter]
vertices
PoolVector2Array vertices [@property getter]
PoolVector2Array vertices [@property setter]

Static functions

_new
NavigationPolygon _new()

Construct a new instance of NavigationPolygon. Note: use memnew!NavigationPolygon instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Detailed Description

var polygon = NavigationPolygon.new() var outline = PoolVector2Array(Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)) polygon.add_outline(outline) polygon.make_polygons_from_outlines() $NavigationPolygonInstance.navpoly = polygon

Using addPolygon and indices of the vertices array.

var polygon = NavigationPolygon.new() var vertices = PoolVector2Array(Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)) polygon.set_vertices(vertices) var indices = PoolIntArray(0, 3, 1) polygon.add_polygon(indices) $NavigationPolygonInstance.navpoly = polygon

Meta