Godot gives you the look_at method which is exactly what you need.
var center = get_viewport().get_rect().size * 0.5
sprite.look_at(center)
Well, it made it look straightforward, but not to the centre of the screen.
Here’s the following code by the way (Ship’s code is commented completely out save for the extends)
Player.gd
extends Node2D
var speed = 2 # rotation speed (in radians)
var radius = 300 # desired orbit radius
var screen_size # Size of the game window.
var center
func _ready():
$Ship.position = Vector2(radius, 0) # desired orbit radius
screen_size = get_viewport_rect().size
center = screen_size * 0.5
func _process(delta):
rotation += speed * delta
$Ship.look_at(center)
iamrifki | 2022-01-16 11:42
Godot considers a node to be facing in the positive x axis in 2d. Looks like your model is pointing towards positive y. Just rotate the sprite 90 degrees (PI/2) to correct. You could do this in code but just turning it in the editor is probably the easiest.