P2 physics



I have to align wooden blocks like this , but after some time wooden blocks are moving slowly and keeps on falling
what property i should use to avoid the crated blocks down


Maybe have a look here:


it still moves , below is my block creation code

    var pfm = this.game.add.sprite(platformArr[i].pos.x,platformArr[i].pos.y,path);
        this.game.physics.p2.enable(pfm, false);

        pfm.body.data.mass = 0.2
        pfm.body.data.gravityScale = 0.5;
        pfm.body.sleepSpeedLimit = 0.01; // Body will feel sleepy if speed<1 (speed is the norm of velocity)
        pfm.body.sleepTimeLimit =  1; // Body falls asleep after 1s of sleepiness
        pfm.body.damping =  0; // Body falls asleep after 1s of sleepiness



this.game.physics.p2.friction = 0;

or maybe (older versions I believe)

this.game.physics.p2.world.defaultContactMaterial.friction = 0;


Thanks, but i tried all the asnwer , but still it collapses. if i reduce the gravity and body mass , it takes time to collapses, the lower the value the higher time it takes to collapse



Maybe put it online somewhere, so we can try some thingsā€¦