Simple physics question

I am experimenting with the physics modeling and would like to know how to alter the force of gravity. What I mean is that I have no problems getting balls to fall and bounce but the gravity vector is always down to the bottom of the screen. What I would like to do is have the balls or objects or whatever accelerate towards a particular spot on the screen, the center, for example. Is this a simple tweak in the physics package?

To simulate that you’ll need to turn off gravity:


And then apply a force to each object you want to move towards the point:

target = vec2(WIDTH/2, HEIGHT/2)
body:applyForce(100 * (target-body.position))

This is just a simplified example, and you’ll need to tweak the amount to multiply the force vector by to get the exact results you want.

Brilliant. Thank you.