How do I rotate a Position2D node to keep pointing (or following) a node (e.g. Player)

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

I have this Scene called Main
enter image description here

I want HoleFromHell which is a Position2D to rotate along with the Player which is an instanced scene. The Player moves in a fixed roundabout way, so it should be easy for HoleFromHell to rotate along with it (not exactly, I want it to have a slight delay), how can I do this?

(Roughly how the Player moves)

enter image description here

extends Node2D

export var speed = 150
export (PackedScene) var Mob

var velocity = Vector2()

var score

func _ready():

func _process(delta):
func game_over():

func new_game():
    score = 0

func _on_MobTimer_timeout():
    var mob = Mob.instance()
    mob.transform = $HoleFromHell.global_transform

func _on_ScoreTimer_timeout():
    score += 1

func _on_StartTimer_timeout():
:bust_in_silhouette: Reply From: iamrifki


$HoleFromHell.rotation = lerp_angle($HoleFromHell.rotation, PI + $HoleFromHell.global_position.angle_to_point($Player/Ship.global_position), 0.6)

to _process()

You could also do:


If you don’t care about adding a delay