Just to clarify, as I've seen this confusion in similar questions, I am not looking for navmeshes or pathfinding right now. For now, I just want to create a simple AI that follows the player if the player hits it's raycast, that's all.
The problem is figuring out how to make the enemy rotate to face the player and move forward in that direction... I haven't got a clue on where to begin...
I have managed to make the AI move in the one direction when it spots the player, but that's about it.
I've tried look_at, but that doesn't seem to actually make the object turn... =/
Here's what I have so far:
if targetRay.is_colliding():
if targetRay.get_collider().is_in_group("Player"):
move(FollowTarget(targetRay.get_collider(), delta))
func FollowTarget(test, delta):
var velocity = Vector3()
if get_translation().distance_to(test.get_translation()) < 100:
currentDirection = currentDirection.linear_interpolate(minusY(-test.get_translation()), clamp(turnSpeed * delta, 0, 1))
look_at(minusY(-test.get_translation()), Vector3(0, 1, 0))
if abs(velocity.z) < tapSpeed:
velocity.z += acceleration * delta
nextAnim = "Rinnin"
return velocity
How do I make it turn and move according to it's direction?