I have an enemy that Is able to target the player using State Charts, but doesn't move from the area that they start with. I am very new with Godot, so ask me any questions you have and I'll try to answer it to the best of my ability. I am also using a tutorial for the enemy script: https://www.youtube.com/watch?v=4DItltKD_LA&t=49s
I pretty sure the the velocity being set while the enemy is not on the floor is for the gravity. If it were placed in the process function, i think that the gravity would only be applied when the player enters the enemies CollisionShape. Correct me if I’m wrong, since I’m really new.
Doesn’t look like your changing velocity much in _physics_process, only applying gravity. Can’t speak to the state machine plugin you are using, are you sure it’s signal is connected like in the video?
Instead of screenshots it’s best to paste scripts as text, between three ticks for a block of code
Yeah, I remember debugging the State Charts to see if they were causing issues, and to me they looked fine. The code on the lines 66 - 68 have the enemy face the player once they enter the “toFollow” state, and those lines of code are working fine.
# Rotate to face movement direction
#(Remove if you want enemy to always face you)
if direction.length() > 0.01:
var target_rotation = atan2(direction.x, direction.z)
rotation.y = lerp_angle(rotation.y, target_rotation, 5.0 * delta)
The NavigationAgent3D debugger also shows a line going from the enemy to the player, which I assume is the path that the enemy would take to get to the player, the only thing is that the enemy isn’t moving. If I need to, I can check the states again.