Added better nav stuff

main
Yan Wittmann 2024-11-07 18:11:31 +01:00
parent af0d9d57e0
commit 391b026c84
4 changed files with 59 additions and 28 deletions

View File

@ -14,3 +14,7 @@ config/name="pathfinding-algorithms"
run/main_scene="res://scenes/tilemap_nav.tscn" run/main_scene="res://scenes/tilemap_nav.tscn"
config/features=PackedStringArray("4.3", "Forward Plus") config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[navigation]
2d/default_edge_connection_margin=40.0

View File

@ -0,0 +1,16 @@
extends Node2D
@onready var floor: NavigationRegion2D = $BaseNavigationRegion2D
@onready var road: NavigationRegion2D = $CheapPathNavigationRegion2D
# @onready var road_poly: Polygon2D = $CheapPathNavigationRegion2D/CheapPath
@onready var road_poly: Polygon2D = $BaseNavigationRegion2D/CheapPath
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
setup.call_deferred()
func setup():
road_poly.hide()
road.navigation_polygon.add_outline(road_poly.polygon)
road.bake_navigation_polygon()

File diff suppressed because one or more lines are too long