Problem with Physics and Gravity
-
- Prole
- Posts: 2
- Joined: Wed Sep 29, 2010 5:12 pm
Problem with Physics and Gravity
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.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Problem with Physics and Gravity
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.
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.
-
- Prole
- Posts: 2
- Joined: Wed Sep 29, 2010 5:12 pm
Re: Problem with Physics and Gravity
That fixed my problem! Thank you.
Who is online
Users browsing this forum: No registered users and 1 guest