How to make NPC turns to player when interacted with

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

So, basically when you talk to them, they would look towards the player. I tried using look_at with global_position but I can’t get it to work, maybe 'cause I’m a total noob at programming…

func sample():
      $NPC.look_at(player.get_global_transform().origin, Vector3.UP)

///////////////
$NPC.rotate_object_local(Vector3(0,1,0), 3.14) # look in the opposite direction

ramazan | 2022-03-19 10:34