I tried following Garbaj's basic enemy pathfinding code, but even though I'm pretty sure I've copied his code exactly my enemies aren't moving. This is my code for the enemy:
onready var navigation = get_parent()
onready var player = $"../Player"
var health = 20
var speed = 10
var path = 
var path_node = 0
if path_node < path.size():
var direction = (path[path_node] - global_transform.origin)
if direction.length() < 1:
path_node += 1
move_and_slide(direction.normalized() * speed, Vector3.UP)
path = navigation.get_simple_path(global_transform.origin, target_pos)
path_node = 0
the node structure in my scene goes like this:
I ran some print functions to do some testing, and while moveto() is being called correctly, the else statement which the moveand_slide() code is on is not being run at all unless the player is moving. As soon as the player stops moving the else statements stops running, but the enemy doesn't move an inch either way.
I have no idea what's going wrong, and I really appreciate any help.