How to change gravity direction to inwards for a pool game?

Hi,

I am new to box 2d and im trying to make a pool game using box2d. I dont know how to make the gravity to work inwards. As far as I know that the gravity is only downwards. If i setup my pool board on the XY plane, the gravity will only work downwards so all the balls will fall to the lower edge of the board. I dont want to take the gravity off, I just want the gravity to work inwards if possible so that the balls can fall though the holes at the four corners of the board.

I will be really grateful if anyone can please help me with this problem.

Kind regards,

Shahed
I am not sure if I understood your setup completely, but I figure you want to have gravity in z-direction. Box2D does not do 3d physics for you.
If you want to use Box2D you could consider your holes to be sensors that attract balls in close proximity via applyForce.
Thank you so much for that mate, i did not know that i can make the board holes as sensors. I dont know how to do that. I will be really grateful if you can give a sample code example of that. Thanks again.

Regards,

Shahed
You should have a look at the Testbed example SensorTest (Testbed/Tests/SensorTest.h).

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