0
votes

i am try to build a tower brick game (there are falling shapes from the sky and they should make a tower) but when i drop the shapes the physics doesnt work and if they on top each other on the corner they do not fall.... how can i fix it?

here is the shape:

var fixDef = new b2FixtureDef;//shape 1
            fixDef.shape = new b2PolygonShape;
            fixDef.density = 0;
            fixDef.friction = 0.5;
            fixDef.restitution = 0.5;


            fixDef.shape.SetAsArray([
                new b2Vec2(-1, 0),
                new b2Vec2(0, -1),
                new b2Vec2(1, 0)],3
            );


            bodyDef.type = b2Body.b2_dynamicBody;    
            bodyDef.position.Set(24.5/30, 60/30);           
            bodyDef.userData = new Traingle();
            addChild(bodyDef.userData);
            world.CreateBody(bodyDef).CreateFixture(fixDef);

and here is the world:

1

1 Answers

1
votes

I think that's because you've set their density to zero. What impact should a zero-weight body make?