Making a Space simulation...

now i have to write some code that applies a gravity field at the current camera position and in every planet (depending on the mass, where the camera would use the value 100)

could someone tell me how to make a “gravity field/area”? like an (invisible) sphere, and all ode objects inside that spherical area will get attacted by its center.