Make GameObject/Model orbit a sphere

How can I make a GameObject/Model orbit a Sphere?

Use RotateAround. Pass it the transform.position of the object you want to rotate around.

You can use either RotateAround as dhendrix mentioned, or you can create an empty GameObject and use this as a pivot for the orbitting GameObject. In Update rotate the pivot around its center and then move your GameObject "distance" along pivot's z-axis.

To do it using physics, you would apply force toward the sphere inside FixedUpdate.



    Vector3 diff = sphere.transomform.position - object.transform.position;
    Vector3 direction = diff.normalized;
    float gravitationalForce = (sphere.mass * object.mass * gravitationalConstant) / diff.sqrMagnitude;
    object.rigidBody.addForce( direction * gravitationalForce );

Gravitation equation taken from: