There seems to be a problem when using b2FixtureDef to create a fixture. With the following code
function createBody(x, y, rot, dynamic) {
var bodyDef = new Box2D.b2BodyDef();
bodyDef.set_position(new Box2D.b2Vec2(x, y));
bodyDef.set_angle(rot);
bodyDef.set_type(dynamic ? Box2D.b2_dynamicBody : Box2D.b2_staticBody);
var body = world.CreateBody(bodyDef);
var shape = new Box2D.b2PolygonShape();
shape.SetAsBox(1, 0.1);
var fixtureDef = new Box2D.b2FixtureDef();
fixtureDef.set_density(1);
fixtureDef.set_shape(shape);
body.CreateFixture(fixtureDef);
return body;
}
I get the error "Uncaught Assertion failed: m_I > 0.0f, at Box2D_v2.2.1/Box2D/Dynamics/b2Body.cpp, 319, void b2Body::ResetMassData()".
What I was also wondering about is why the b2MassData is not available as javascript class in the Box2D namespace.
There seems to be a problem when using b2FixtureDef to create a fixture. With the following code
I get the error "Uncaught Assertion failed: m_I > 0.0f, at Box2D_v2.2.1/Box2D/Dynamics/b2Body.cpp, 319, void b2Body::ResetMassData()". What I was also wondering about is why the b2MassData is not available as javascript class in the Box2D namespace.