Problem with Physics and Gravity

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Eisentefel
Prole
Posts: 2
Joined: Wed Sep 29, 2010 5:12 pm

Problem with Physics and Gravity

Post by Eisentefel » Wed Sep 29, 2010 5:16 pm

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.

User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Problem with Physics and Gravity

Post by kikito » Wed Sep 29, 2010 5:31 pm

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.
When I write def I mean function.

Eisentefel
Prole
Posts: 2
Joined: Wed Sep 29, 2010 5:12 pm

Re: Problem with Physics and Gravity

Post by Eisentefel » Thu Sep 30, 2010 7:23 pm

That fixed my problem! Thank you.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 362 guests