0 votes

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 physicsprocess(delta):
var toplayer = translation.directionto(player.translation)
moveandslide(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

in Engine by (26 points)

1 Answer

+1 vote

You should check out "Intro to Steering Behaviors in Godot part 1: Follow AI" (2019-10-13) tutorial series:
https://www.youtube.com/watch?v=UWlErVIJIw0

When you are done watching/coding just download project end source code from github:
https://github.com/GDQuest/godot-demos/tree/master/2019/08-13-steering-follow-arrive

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

Good Luck,
oofman

by (74 points)
edited by

Thanks oofman! I'll definitely check it out!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.