pretty weird issue with rotating a sphere

Hey everyone, i’ve stumbled upon a pretty weird issue when rotating a sphere.

Even though the sphere has absolutely neither parents nor children, it seems to be rotating around something…

here’s the rotation code :

transform.Rotate(touchDeltaPosition.y * speeed,-touchDeltaPosition.x * speeed, 0,Space.World);

Also, i’ve already tried to attach a rigidbody and freeze x,y and z positions, no success

Have you tried using space.self, instead of space.world?

though im not sure it would help.

If that doesnt work you can try the following; spawn a new gameobject, then move said gameobject to the center of your sphere, set the sphere as a child of the gameobject, then apply the rotation to the gameobject instead.

If that doesnt work, then im out of ideas.

just out of curiosity, where is the pivot of the sphere located?

Wolfram did offer a nice solution, mostly already given elsewhere: use renderer.bounds.center along with RotateAround:

transform.RotateAround(renderer.bounds.center, new Vector3(1, -1, 0), speeed); //  <-- why 3 e's speed?

The only problem in this solution is that we can’t set the rotation to a specific value.

Here’s another Wolfram’s idea that will use the same renderer.bounds.center but with a parenting GameObject instead:

	GameObject myContainer = new GameObject();
	myContainer.name = "rot_" + transform.gameObject.name;
	myContainer.transform.position = renderer.bounds.center;
	myContainer.transform.parent = transform.parent;
	transform.parent = myContainer.transform;

	// now rotate myContainer at your will
	myContainer.transform.Rotate(touchDeltaPosition.y * speeed,-touchDeltaPosition.x * speeed, 0,Space.World);