Hi All,
I have been doing some work linking Box2D with OpenFrameworks and OpenCV to allow for people to create their own simulation by moving in front of a camera, everything is moving along nicely, but when I start allowing the creation of multiple bodies in the same frame in very similar locations, I am crashing.
Is there a limit on how many bodies can be created simultaneously in the same location? Is lots of interpenertration bad?
I found I could get the PolyShapes test to crash if I changed (in PolyShapes.h, line 135) from:
To:
If I tap away at my keys, I can get a crash fairly quickly.
I have been doing some work linking Box2D with OpenFrameworks and OpenCV to allow for people to create their own simulation by moving in front of a camera, everything is moving along nicely, but when I start allowing the creation of multiple bodies in the same frame in very similar locations, I am crashing.
Is there a limit on how many bodies can be created simultaneously in the same location? Is lots of interpenertration bad?
I found I could get the PolyShapes test to crash if I changed (in PolyShapes.h, line 135) from:
Code:
void Keyboard(unsigned char key)
{
switch (key)
{
case '1':
case '2':
case '3':
case '4':
case '5':
CreateBody(key - '1');
break;
case 'd':
DestroyBody();
break;
}
}
{
switch (key)
{
case '1':
case '2':
case '3':
case '4':
case '5':
CreateBody(key - '1');
break;
case 'd':
DestroyBody();
break;
}
}
To:
Code:
void Keyboard(unsigned char key)
{
switch (key)
{
case '1':
case '2':
case '3':
case '4':
case '5':
for(int bodyCount = 0; bodyCount < 32; bodyCount++)
{
CreateBody(key - '1');
}
break;
case 'd':
DestroyBody();
break;
}
}
{
switch (key)
{
case '1':
case '2':
case '3':
case '4':
case '5':
for(int bodyCount = 0; bodyCount < 32; bodyCount++)
{
CreateBody(key - '1');
}
break;
case 'd':
DestroyBody();
break;
}
}
If I tap away at my keys, I can get a crash fairly quickly.