Ankylose sorry, I was on the phone when I wrote that code.
I tested this one and it works, though you need to test it with your game:
extends RigidBody3D
@onready var other = $"../MeshInstance3D"
@onready var label_3d = $"../Label3D"
func _physics_process(delta):
var facing : float = (basis * Vector3.BACK).signed_angle_to(other.global_position, Vector3.UP)
label_3d.text = str(facing)
if facing > 0.4:
constant_torque = Vector3(0.0, 8.0, 0.0)
#add_constant_torque(Vector3(0.0, -0.08, 0.0))
elif facing < -0.4:
#add_constant_torque(Vector3(0.0, 0.08, 0.0))
constant_torque = Vector3(0.0, -8.0, 0.0)
else:
constant_torque = Vector3(0.0, 0.0, 0.0)