0 votes

setting angle of an object toward to another object position ??
example:

object 1 position is in the right down corner of the screen
object 2 position is in the middle of the screen
so i want the object 2 set its angle / facing toward object 1 position every time.. even when i move object 1 .. the object 2 still setting its angle / facing toward to object 1 ... any idea ?

in Engine by (19 points)
reshown by

1 Answer

+1 vote

if its a 3d game you can use the look_at() function running inside a function that is update each frame like _process(). I believe 2d also have something similar as well.

by (273 points)

Yes, the Node2D (and every derived) class has look_at() function.

it works really well ! thx alot !

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.