Using LookAt on spherical worlds

I have a spherical world which a player walks on. The player is rotated towards the mouse. This works fine when you first spawn and walk a bit, but once you are about halfway to the other side, the player looks in the wrong direction. Any ideas?

	void Update() {
		Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		RaycastHit hit;
		if (Physics.Raycast(ray, out hit, 100))
			Debug.DrawLine(ray.origin, hit.point);
			Vector3 pos = hit.point;
		float distanceToPlane = Vector3.Dot(transform.up, pos - transform.position);
		Vector3 planePoint = pos - transform.up * distanceToPlane;
		holder.LookAt(planePoint, transform.up);
	}

	void LateUpdate() {
		spine.localEulerAngles = new Vector3(360-holder.rotation.eulerAngles.y,0f,0f);
	}

Just a little note, on the LateUpdate function, I put a “360-”, if I removed that, then my situation would be flipped. So, the rotating on the other side of the planet would work, but not on the side I spawn on.

Suggest you define the “facing” of your character using only a single float, generated something like this: mathf.Atan(mouse.y/mouse.x). This is because you are walking him on a “surface” which is 2D, and it appears, he cannot face up or down or spin around vertically. His facing is just some amount north/south and some amount east/west, which can be defined as a single floating point number: the number of degrees around from north.

Now that you have an angle, using his position we can easily determine the character’s rotation transform quaternion using Quanternion.AngleAxis(float angle,Vector3 axis). The angle is the character “facing” described above, and the axis is the characters position on the sphere (character position vector minus the sphere’s position vector, if the sphere is not at 0,0,0).