So i've been working on this game that requires "a lot" of physics bodies (and shapes) and when i hit a particular number (i think 30) i get this popup and love.exe shuts down:
Any ideas on how fix this? (I would like a larger amount of bodies)
Physics error (halp!)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Physics error (halp!)
30 objects seems a very feasible number.
Are all your objects created the same way?
Your problem could be not related with the number of objects created, but with how they are created.
I've seen before a forum post in which box2d complained like this; what happened in that case was that the created objects were either impossible or just too small (a circle with radius 0 or a polygon with an area of less than 3 units, if I remember correctly).
If you have several ways of creating objects, try "deactivating" some of them until you detect the one that makes box2d go puff.
Are all your objects created the same way?
Your problem could be not related with the number of objects created, but with how they are created.
I've seen before a forum post in which box2d complained like this; what happened in that case was that the created objects were either impossible or just too small (a circle with radius 0 or a polygon with an area of less than 3 units, if I remember correctly).
If you have several ways of creating objects, try "deactivating" some of them until you detect the one that makes box2d go puff.
When I write def I mean function.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Physics error (halp!)
I think it might be that there are too many collisions.
Re: Physics error (halp!)
That might be possible! My bodies are 32x32 blocks stuck together in a grid. That might be the problem, seems I have to make some space between them.bartbes wrote:I think it might be that there are too many collisions.
Re: Physics error (halp!)
Update:
Okey, I've done a new test where I have not made collisions between the bodies ( i am monitoring it with the collision callbacks), but the error keeps coming.
Any other suggestions?
Ps. The program keeps running at the same amount of memory (17 000 kb), so nothing is stealing the memory.
EDIT:
I think i fixed, i basically put the bodies which doesn't do much to "sleep".
Stress test: (white lines = bodies)
Okey, I've done a new test where I have not made collisions between the bodies ( i am monitoring it with the collision callbacks), but the error keeps coming.
Any other suggestions?
Ps. The program keeps running at the same amount of memory (17 000 kb), so nothing is stealing the memory.
EDIT:
I think i fixed, i basically put the bodies which doesn't do much to "sleep".
Stress test: (white lines = bodies)
- The Burrito
- Party member
- Posts: 153
- Joined: Mon Sep 21, 2009 12:14 am
- Contact:
Re: Physics error (halp!)
Pairs are something like collisions (from what I understand), theres a limit to how many it will create simultaneously, the pop up error is it reaching the limit. Pairs are created any time 2 objects overlap, so I guess your grid of boxes just makes a lot of them (perfect alignment would probably create 8 for each box in the middle of others), I'm not sure how you plan on using this grid of boxes, but theres a lot of tricks that may make it work better.
Theres a limit to the number of shapes you can have at a given time (I think its in the 150-200 range) but there doesn't seam to be a limit on bodies.
Oh yeah, and usually if you click ignore enough times box2d will work through the errors.
Theres a limit to the number of shapes you can have at a given time (I think its in the 150-200 range) but there doesn't seam to be a limit on bodies.
Oh yeah, and usually if you click ignore enough times box2d will work through the errors.
Re: Physics error (halp!)
Are you sure about that? In the picture there are 600 shapes and bodies, and didn't even make it laggyThe Burrito wrote: Theres a limit to the number of shapes you can have at a given time
- The Burrito
- Party member
- Posts: 153
- Joined: Mon Sep 21, 2009 12:14 am
- Contact:
Re: Physics error (halp!)
my mistake, its at around 1200 shapes that I get errors, not 200. (I can math!)
Re: Physics error (halp!)
I've had this problem in Lovely Mario Brothers. It's too many objects colliding in one space.
Twitta! http://twitter.com/#!/CodaBrink
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 5 guests