22 lines
560 B
GDScript
22 lines
560 B
GDScript
extends NavigationLink3D
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
_flatten_link.call_deferred()
|
|
|
|
|
|
func _flatten_link() -> void:
|
|
await get_tree().physics_frame
|
|
|
|
var map: RID = get_world_3d().get_navigation_map()
|
|
|
|
var start = to_global(start_position)
|
|
var end = to_global(end_position)
|
|
|
|
print('Moving end from', end)
|
|
|
|
start_position = to_local(NavigationServer3D.map_get_closest_point(map, start))
|
|
end_position = to_local(NavigationServer3D.map_get_closest_point(map, end))
|
|
print('to', end_position)
|