Gravity Point?

Is there a straight-forward way of making gravity a static point in space rather than just a direction vector? I'm looking for something like a planetary gravitational force that attracts all the bodies with-in its radius. I could just apply impulses at certain intervals (which is what I'm doing now), but I wanted to find an solution thats part of the core integrator. Can anyone suggest a work-around for this?
Your method is the right way to do it, assuming you turn world gravity off completely - personally, I would just apply a force to each body instead of impulses, because if you change your time step later you'll need to change the impulse values proportionally to keep the same behavior, but the force would be the same. To a decent approximation you can consider gravity to be an inverse square force applied to each body's center of mass with no torque; I've rarely seen a game situation that calls for more accuracy than that.

If you're worried about having to deal with too many bodies, you can query the broadphase for bodies within an AABB - I think the mouse picking part of the testbed does this if you need to see how. Once the AS3 port is updated to 2.0 sensors would also be a good way to handle this, but I'm not sure how long that will be given that the C++ 2.0 version hasn't even been officially released yet.
I believe the sensors test in testbed for 2.0 is almost exactly what you want. The good news is, you don't have to wait for the 2.0 port, because sensors are extremely easy to add in to 1.4.3! See this topic and let me know if you have any problems understanding what you have to change or getting it working.

Original thread: https://box2d.org/forum/viewtopic.php?t=401