Hi,
recently i have encountered kinda major bug, namely it is tunneling of a static chain shape and a dynamic polygon.
Here is the code, which generates a chain shape:
And here the code which generates my movable polygon:
Yea, I know, nothing special in here.
I also noticed, that tunneling occurs almost everytime, when the chain contains very sharp angles.
It is also worth mentioning that if i replace b2ChainShape with a set of b2EdgeShape, then everything works like a charm.
Is this because of the size of my polygon? How should i try to fix that?
I attached a pic of this situation.
recently i have encountered kinda major bug, namely it is tunneling of a static chain shape and a dynamic polygon.
Here is the code, which generates a chain shape:
Code:
b2Vec2 pointz[] = {
b2Vec2(31, 13), b2Vec2(40, 38), b2Vec2(25, 12)
};
b2ChainShape shape;
shape.CreateLoop(pointz, 3);
b2BodyDef def;
b2Body* lulzBody = world.CreateBody(&def);
lulzBody->SetType(b2_staticBody);
lulzBody->CreateFixture(&shape, 0);
b2Vec2(31, 13), b2Vec2(40, 38), b2Vec2(25, 12)
};
b2ChainShape shape;
shape.CreateLoop(pointz, 3);
b2BodyDef def;
b2Body* lulzBody = world.CreateBody(&def);
lulzBody->SetType(b2_staticBody);
lulzBody->CreateFixture(&shape, 0);
And here the code which generates my movable polygon:
Code:
b2BodyDef bodyDef;
bodyDef.position.Set(60, 1);
b2Body* pBody = world.CreateBody(&bodyDef);
b2PolygonShape box;
box.SetAsBox(1, 1);
pBody->CreateFixture(&box, 0);
pBody->SetType(b2_dynamicBody);
bodyDef.position.Set(60, 1);
b2Body* pBody = world.CreateBody(&bodyDef);
b2PolygonShape box;
box.SetAsBox(1, 1);
pBody->CreateFixture(&box, 0);
pBody->SetType(b2_dynamicBody);
Yea, I know, nothing special in here.
I also noticed, that tunneling occurs almost everytime, when the chain contains very sharp angles.
It is also worth mentioning that if i replace b2ChainShape with a set of b2EdgeShape, then everything works like a charm.
Is this because of the size of my polygon? How should i try to fix that?
I attached a pic of this situation.