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 method, or using the add_polygon method.

    Using :

    Using add_polygon and indices of the vertices array.

    1. var vertices = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
    2. $NavigationPolygonInstance.navpoly = polygon

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


    • void add_outline_at_index ( outline, int index )

    • void add_polygon ( polygon )

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


    • void clear_outlines ( )

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


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


    • get_outline ( int idx ) const

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


    • int get_outline_count ( ) const

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


    • get_polygon ( int idx )

    • get_polygon_count ( ) const

    Returns the count of all polygons.


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


    • void make_polygons_from_outlines ( )

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


    • void remove_outline ( int idx )

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


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


    • void set_vertices ( vertices )