Well I don't think that Bullet physics support multiple attractors out of the box, even though in bullet you can set the gravity per object, Bullet still assumes the objects are being simulated under a global gravity value set for the entire scene, in other words it assumes that the objects gravitational force is neglected in comparison to the planet/surface they dwell on, which is clearly not the case of real planets.
The Solution
Never the less, I can recommend you set the global gravity to 0.0 and simulate planets' gravity using Newton's law of universal gravitation based on each planet's mass, now when any planet is within the other planets gravitational distance you can calculate the force, which can be done using a btSphereShape
collider.
After you calculate the gravitational force for each planet you can apply it's gravity on other planets using btRigidBody::applyForce
.
The problem though...
Well if you ever heard of the three-body problem you will know that calculating gravitational force between three planets is particularly unsolvable (or hard to solve?) , quoting from Wikipedia:
In its traditional sense, the three-body problem is the problem of
taking an initial set of data that specifies the positions, masses and
velocities of three bodies for some particular point in time and then
determining the motions of the three bodies, in accordance with the
laws of classical mechanics (Newton's laws of motion and of universal
gravitation).
This will make you approximate the actual motion of the planets rather than calculate the exact one. By reducing the problem to one static body, and calculating the motion of the other body. Then you will find that the motion of a body under gravity is an ellipse.
But that's not a huge problem, since you will get a fine approximation, quoting from this article
But even with just mechanical pencil and paper there are cheats. For
example, although there are more than three bodies in the solar system
(the Sun, eight planets, dozens of moons, and millions of asteroids
and comets), almost everything behaves, roughly, as though it were in
a two body system. Basically, this is due to the pronounced size
differences between things. As far as each planet is concerned, the
only important body in the rest of the universe is the Sun. To get
some idea of why; the Sun pulls on the Earth about 200 times harder
than the Moon, and about 20,000 times harder than Jupiter. Nothing
else even deserves a mention. So, if you want to calculate the orbits
of all the planets, a “2-body approximation” will get you more than
99% of the way to the right answer.