Hey thanks for showing me useful suggestions.
In the end I use look_at and brute force it. Using rotate_toward also gives me the shortest rotation to.
I’d still love to see a more elegant way to do this though.
func _process(delta):
var node3d_rotation = node3D.global_rotation_degrees.y
var rotate_target = 0
node3D.look_at(player.global_transform.origin,Vector3.UP)
if (node3d_rotation < 25 and node3d_rotation > -25):
rotate_target = 0
elif node3d_rotation > 25 and node3d_rotation < 75 :
rotate_target = PI/4
elif node3d_rotation > 75 and node3d_rotation < 112 :
rotate_target = PI/2
etc...
turret.rotation.y = rotate_toward(turret.rotation.y, rotate_target, 2 * delta)