Rotate object alongside inner walls of a sphere

Let’s suppose i am in the center of a sphere and want to rotate an object alongside the walls. I’m using orbit controls, so currently i’m getting the azimuth angle (theta) and polar angle (phi) and trying to calculate x, y, z coords for the object.

This works to some degree (no pun intended), using Vector3.setFromSpherical. The issue is, the vertical movement works, while the horizontal movement is inverted. If i move the mouse to the right, the object is moved to the left.

Is there any way to invert the polar/phi angle in a clean way? If there is any other approach, i’d be highly thankful if someone could point it out, since intuitively it should be super simple.

I share that intuition.

My 1st attempt would be to replace

theta

with

2 * Math.PI - theta

I maybe wrong with understanding of what you want to achieve, but position in front of the object, controlled by OrbitControls (camera?), on the inner surface of a sphere is object’s normalized negated position multiplied with sphere radius.

destination.position.copy(camera.position).normalize().negate().setLength( radius )

:thinking: