tweaks to navmesh

This commit is contained in:
Vivianne 2023-10-06 03:49:02 -07:00
parent 2831f9620e
commit 20754c6c73
2 changed files with 5 additions and 1 deletions

View file

@ -98,6 +98,7 @@ polygon = PackedVector2Array(32, -25, 33, 24, 269, 129, 269, -126)
[node name="Navigation" type="NavigationAgent2D" parent="."]
avoidance_enabled = true
radius = 60.0
max_speed = 150.0
debug_enabled = true
[connection signal="velocity_computed" from="Navigation" to="." method="_on_navigation_velocity_computed"]

View file

@ -12,7 +12,10 @@ func _physics_process(delta):
if not $Navigation.is_target_reachable():
go_to_interesting_spot()
$Navigation.velocity = position.direction_to($Navigation.get_next_path_position()) * 100
var pos = $Navigation.get_next_path_position()
var dir = position.direction_to(pos)
$Navigation.velocity = dir * 1000
transform = transform.looking_at(pos)
func say_shit(shit):
print(self.name, ": ", shit)