Hi,I used setVisible (false) and setActive (false) on the block to temporarily hide it, but the physics continue to work.
Is there a way to stop it completely so that it doesn’t show up even in Matter debug mode?
class Example extends Phaser.Scene
{
preload ()
{
this.load.image('block', 'assets/sprites/block.png');
}
create ()
{
this.matter.world.setBounds();
const block1 = this.matter.add.image(300, 100, 'block', null, { chamfer: 16 }).setBounce(0.9);
const block2 = this.matter.add.image(400, 100, 'block', null, { chamfer: 16 }).setBounce(0.9);
const block3 = this.matter.add.image(500, 100, 'block', null, { chamfer: 16 }).setBounce(0.9);
//Temporarily deactivate the central block
block2.setVisible(false); block2.setActive(false);
this.matter.add.mouseSpring({ length: 1, stiffness: 0.6 });
}
}
const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#1b1464',
parent: 'phaser-example',
physics: {
default: 'matter',
matter: {
debug: true
}
},
scene: Example
};
const game = new Phaser.Game(config);
thanks