YolloY
Thanks. Still, I should update you on what's going on. I went to ChatGPT again, they gave me a solution that didn't destroy my project like they did last time. However, their solution seem to have done absolutely nothing when I tested it or at least to my eyes. ChatGPT told me to place nav_agent.connect("velocity_computed", Callable(self, "_on_nav_velocity_computed")) in the parent's _ready() function and then told me to put this function in the parent:
var _nav_safe_velocity: Vector3 = Vector3.ZERO
func _on_nav_velocity_computed(safe_velocity: Vector3) -> void:
_nav_safe_velocity = safe_velocity
According to ChatGPT, my follow_path() already uses this "logic" because it has this line:
var adjusted_velocity = parent._nav_safe_velocity if ("_nav_safe_velocity" in parent) and parent._nav_safe_velocity.length() > 0.0001 else target_h
What would help me is if I could recognize if my follow_path() has a variable like new_velocity, as shown in the video tutorial. The only similiar variable I have is the desired variable. However, even then, the desired variable doesn't get past into the set_velocity() function parameter directly thanks to current_h and target_h; leading to target_h getting placed inside the set_velocity() function.
However, after watching the video again, I don't think any of that is supposed to matter. What should matter is that function for the velocity computed function should look like the one in the video, or at least that's my interpretation of it. So that's what I did.
Now my _on_nav_velocity_computed() function looks like this:
func _on_nav_velocity_computed(safe_velocity: Vector3) -> void:
velocity = velocity.move_toward(safe_velocity,.23)
move_and_slide()
Now I've got the same problem that "broke" the game all over again. Enemies are now moving in states that don't require movement.😵
The good news is, I'm closer to understanding what the problem is or isn't. Originally, I though the problem is that I connected the velocity computed signal to my enemy's state base class( which means that every state would inherit a connection to the signal). Now I'm certain that it doesn't matter where the signal is connected; it's still going to cause the exact same problems for me.
Edit: So I updated the _on_nav_velocity_computed() function again to look like this:
func _on_nav_velocity_computed(safe_velocity: Vector3) -> void:
velocity = safe_velocity
What's good about this, is that it didn't cause all my states to behave strange. However, it doesn't seem to make a different. The enemies aren't avoiding each other.
Edit again: It seemed to work when I increased "Radius". Here's the tutorial that helped.
I'm not completely satisfied with the results yet. I'm going to go revisit some of the code ChatGPT gave me just to see something.
Edit more time: Okay. Remember when I talked about how ChatGPT gave me this:
func _on_nav_velocity_computed(safe_velocity: Vector3) -> void:
_nav_safe_velocity = safe_velocity
Apparently, that works too. LOL! Yeah, I think I'm satisfied with the solution for now. Anyway, thanks to everyone who replied to me. 🙂