How to lock an objects orbiting focal point.

I am helping a friend to develop a small mobile app that can simulate very basic orbiting scenarios with different sized objects. Everything works perfectly except that I would like to somehow lock the 1-2 “planets” in the game world so that their combined center of mass Vector3 is always the center of the screen (or How hard would it be to make this work?

I actually figured it out on my way to work this morning. What I did initially was have both objects apply a force towards the other, based on the others mass. What I did to get it to do what I wanted was have an empty game object in the center of the world called “Center of Mass” and made the object I can manipulate orbit that object, the other object then orbits directly opposite except that it is either closer or further from the Center of Mass depending on the ratio between its mass and the mass of both objects.