i have a Big Cylinder and a Small Sphere .
i need to make the sphere rotating around the cylinder 360 degrees at the top Surface
at the same time the Cylinder will rotate some times by x and some times by y and some by z

so some times the Cylinder maybe rotating


Dirty-simple solution (if it suits your case):
- create an empty game object as a child of your cylinder
- move it to the center of the cylinder on the surface of the end cap and make sure it’s local z pointing up, perpendicular to the surface of the cylinder
- make your sphere a child of this empty game object
- move your sphere in position, at the edge of the cylinder
- rotate (turn in place) the empty game object whenever you like around its up-vector, the sphere will travel around the edge of the cylinder
cant understand how to make this point " make sure it’s local z pointing up, perpendicular to the surface of the cylinder"
i am rotating the Cylinder z Axis but Sphere rotation is wrong
public class Rotating : MonoBehaviour
{
public float RS=90,Radios=1;
public GameObject EmptyGameobject,Cylinder;
void Update()
{
transform.RotateAround(EmptyGameobject.transform.position,
new Vector3(0,1, Cylinder.transform.rotation.z),
RS * Time.deltaTime);
}
}