ShapeCast3d/RayCast3D target problems

(Godot 4.2)

Since SpringArm3D doesn’t work for my camera setup, I’ve attached a ShapeCast3D to my player. The shapecast is supposed to cast at the camera’s global position, the camera is child of a helper node which in turn is set to copy the position (not rotation) of the player. By rotating the helper, the camera orbits & looks at the player.
When the shapecast hits something, the camera gets translated towards and/or above the player, depending on the result of shapecast.get_closest_collision_safe_fraction(). If it’s not colliding, the camera’s y position handled in _input() and depends on mouse motion.
This works …kind of. Or it would work really well if the shapecast would consistently target the camera. But it will often just project in a totally different direction (see pics - the shapecast is the sphere), sometimes to really far away points. I can’t figure out why and would be really grateful for pointers.

root
-camera_helper (rotates w/ mouse movement; copies global_position from player)
–camera
—shapecast_target
-player
–look_at_target_helper
—ShapeCast3D

the code for the Shapecast3D is (in _physics_process)

	shapecast.set_target_position($"../../camera_helper/main_Camera3D/shapecast_target".global_position)
	shapecast.force_shapecast_update()
	if shapecast.is_colliding():
		safe_margin = shapecast.get_closest_collision_safe_fraction ()
		if safe_margin < 0.2:
			camera.transform.origin.z = lerp(camera.transform.origin.z, camera_close, 0.05)
		elif safe_margin 	>= 0.2:
			camera.transform.origin.z = lerp(camera.transform.origin.z, camera_default_z*safe_margin, 0.05)
			camera.transform.origin.y = lerp(camera.transform.origin.y, 3.0, 0.01)
	else:
		camera.transform.origin.z = lerp(camera.transform.origin.z, camera_default_z, 0.05)

note: I’ve changed the target’s position to be in the ShapeCast3D’s local space like so:
shapecast.set_target_position(to_local($“…/…/camera_helper/main_Camera3D/shapecast_target”.global_position))
…but still no dice. The cast goes all over the place and overshoots the orbit distance.