Rotation around a planet not quite working

I am rotating a GameObject around a planet so it can be placed.

The horizontal works perfectly but I can’t get the vertical to work properly.

I am not using a character controller and gravity is turned off on the rigidbody. I have locked the X, Y, Z for Position and Rotation so that the object is always facing the planet. I have an additional script that keeps the camera always above the object being placed.

Here is my Update code for the object:

MoveHoriz = Input.GetAxisRaw("Horizontal") ;

MoveVert = Input.GetAxisRaw("Vertical") ;

transform.RotateAround(, new Vector3(0, -1, 0) * MoveHoriz, 50 * Time.deltaTime);

transform.RotateAround(, new Vector3(-1, 0,0) * MoveVert, 50 * Time.deltaTime);

Solving these problems can be tricky and game dependent. The issue is that you are rotating around world axes. So if your object is on a world axis, then the object will spin in place and not move. You would have the issue with “Horizontal” as well if you moved first to the size of your sphere before you did any horizontal movement.

Assuming your character is standing on the sphere, with negative ‘y’ down, you can use forward and right as the axes:

void Update () {
		float moveHoriz = Input.GetAxisRaw("Horizontal") ;
		float moveVert = Input.GetAxisRaw("Vertical") ;
		transform.RotateAround(, transform.forward * moveHoriz, 50 * Time.deltaTime);
		transform.RotateAround(, -transform.right * moveVert, 50 *