Set an object angle toward another object position ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AnotherUserz 1
:warning: Old Version Published before Godot 3 was released.

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

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 ?

:bust_in_silhouette: Reply From: vonflyhighace2

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.

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

bruteforce | 2017-02-15 08:28

it works really well ! thx alot !

AnotherUserz 1 | 2017-02-15 09:57