gai-godot-games/pathfinding-algorithms/scenes/custom-solver/custom_graph_solver.gd

13 lines
434 B
GDScript
Raw Normal View History

2024-11-12 15:00:58 +01:00
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)