Box2d error

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Splizard
Prole
Posts: 2
Joined: Wed Jun 20, 2012 3:37 am

Box2d error

Post by Splizard »

I am creating an RTS game in love and I am using love.physics so units can push each other about.

I have encountered this error while a lot of units are grouped togethor, pushing each other around and moving:

Code: Select all

terminate called after throwing an instance of 'love::Exception'
  what():  Box2D error: cache->count <= 3
Aborted (core dumped)
What does this mean?
Do I have too many bodies in the game colliding with each other?
Or is this a love/box2d error?

I would rather not post the .love file but would be happy to post an image of the situation before this error occurs.

Any help is apreciated :awesome:
User avatar
OmarShehata
Party member
Posts: 259
Joined: Tue May 29, 2012 6:46 pm
Location: Egypt
Contact:

Re: Box2d error

Post by OmarShehata »

More info is needed.

Exactly how many boxes are colliding against each other?

In my personal experience I've found that box2d works pretty well as long as you're under, say, 100 objects. And if they're all pushing forcefully against each other, well if I remember correctly, the way box2d resolves these collisions is that it keeps shifting the box back and forth until it finds where it should reside, or something like that. As explained here http://www.box2d.org/manual.html#_Toc258082976 this can be controlled by "positionsIterations" and "velocityIterations" in the world, but I can't seem to find these properties in love's box2d.

Anyway yes, having too many boxes pushing hard against each other would *probably* not be a good idea. Is this the only physics feature you need? If so you, doing it on your own would probably yield better results, and the feel of the game will be more personalized.
User avatar
Splizard
Prole
Posts: 2
Joined: Wed Jun 20, 2012 3:37 am

Re: Box2d error

Post by Splizard »

Thanks for your reply OmarShehata
I just saw this topic on the forums: viewtopic.php?f=4&t=9643

To resolve that error It was said to place Lua's collectgarbage function in the endContact callback.
Although this applied to a different error than mine, I gave it a try and it seems to work!
I can not reproduce the error :ultrahappy:
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests