I'm currently using the following code to create a player object
Code:
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.position.Set(2.0f, 0.0f);
b2Body* body = world->CreateBody(&bodyDef);
b2PolygonShape box;
box.SetAsBox(2.0f, 2.0f);
b2FixtureDef fixtureDef;
fixtureDef.shape = &box;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.3f;
body->CreateFixture(&fixtureDef);
and the following code to create a b2ChainShape
Code:
vector<b2Vec2> points;
for (int i = 0; i < 5; i ++)
{
points.push_back(b2Vec2(i * 1.0f,1.0f));
}
b2ChainShape chain;
chain.CreateChain(&points[0], points.size());
b2BodyDef bodyDef;
bodyDef.position.Set(0.0f, 0.0f);
b2Body* body = world->CreateBody(&bodyDef);
b2FixtureDef fixtureDef;
fixtureDef.shape = &chain;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.3f;
body->CreateFixture(&fixtureDef);
But during update, when the two collide I get a crash at line 203 of b2ContactManager.cpp
Code:
if (edge->other == bodyA)
But I'm not sure why?
Can I get some help?