This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have been looking around, and I can't seem to find an answer that works for me. I have a 3d enemy that I want to make constantly look at the player as long as they are in its area. I would appreciate if someone could write a short sample code or something.

in Engine by (15 points)

1 Answer

0 votes


I haven't tried developing in 3D but I have encountered this problem in 2D when I wanted zombies to keep looking at my player whenever my player can be seen. And I have found the answer here. Only for 2D though but I hope it helps.

Basically, subtracting the position of the zombie and my player then normalizing it will give out the vector pointing to the direction of my player. Go ahead and give the link above a look and you'll know what I'm talking about.

by (105 points)
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 Frequently asked questions and 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 [email protected] with your username.