Page 1 of 1
Problem with Physics and Gravity
Posted: Wed Sep 29, 2010 5:16 pm
by Eisentefel
Hello everyone, I'm new here. I'm trying to make a puzzle game where you manipulate blocks by changing the gravity, and I'm running into a problem. I have the changing gravity down, but once the ball that I'm using for my test object stops moving, it won't start moving again no matter how much gravity I apply. Does anyone know what my problem might be? Thanks in advance.
Re: Problem with Physics and Gravity
Posted: Wed Sep 29, 2010 5:31 pm
by kikito
Box2D puts bodies that don't hit anything on a mode called 'sleeping', which basically saves calculations. Bodies hit by other objects are woken up automatically.
Your ball probably falls asleep because there are no other objects for it to interact with.
Try adding
ball:setAllowSleeping(false) to your code and see how it goes.
Re: Problem with Physics and Gravity
Posted: Thu Sep 30, 2010 7:23 pm
by Eisentefel
That fixed my problem! Thank you.