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 »

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 »

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 »

That fixed my problem! Thank you.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest