From 20754c6c73b5f0dc8870bb406d0a77ecd6adae7e Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Fri, 6 Oct 2023 03:49:02 -0700 Subject: [PATCH] tweaks to navmesh --- bad_dude.tscn | 1 + mean_dude.gd | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bad_dude.tscn b/bad_dude.tscn index c5ecf28..ec60356 100644 --- a/bad_dude.tscn +++ b/bad_dude.tscn @@ -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"] diff --git a/mean_dude.gd b/mean_dude.gd index ec1bc1f..6f5fd32 100644 --- a/mean_dude.gd +++ b/mean_dude.gd @@ -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)