13 lines
434 B
GDScript
13 lines
434 B
GDScript
|
extends Node2D
|
||
|
|
||
|
# @onready var navigation_polygon: Polygon2D = $TestPolygon2D
|
||
|
@onready var navigation_polygon: Polygon2D = $NavPolygon2D
|
||
|
@onready var graph: NavigationGraph = $NavGraph
|
||
|
@onready var character: CharacterBody2D = $CharacterBody2D
|
||
|
|
||
|
func _ready() -> void:
|
||
|
navigation_polygon.hide()
|
||
|
var polygons = Geometry2D.decompose_polygon_in_convex(navigation_polygon.polygon)
|
||
|
|
||
|
graph.erase_and_create_nodes_from_polygons(polygons)
|