3D AI that follows player until close enough without groups

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Wodsobe Dobe

Hello. I am making a 3d game in which you have a side kick that follows you constantly unless told to or is close enough to the player. I have this so far from another Godoter:

func _physics_process(delta):
var to_player = translation.direction_to(player.translation)
move_and_slide(to_player * speed)
velocity.y += delta * gravity

But there’s no gravity, and the sidekick isn’t facing the player, and I can’t figure that one out either. Is there anyway any of ya’ll can help me please? Thanks

:bust_in_silhouette: Reply From: oofman

You should check out “Intro to Steering Behaviors in Godot part 1: Follow AI” (2019-10-13) tutorial series:

When you are done watching/coding just download project end source code from github:

Copy and replace code to your project and you should have what you want! :slight_smile:

Good Luck,
oofman

Thanks oofman! I’ll definitely check it out!

Wodsobe Dobe | 2020-01-16 19:08