How to set moving platform or wall immovable on matter physics

How to set platform immovable on matter physics,
From Arcade physics
It use
movingPlatform = this.physics.add.image(400, 400, "ground"); movingPlatform.setImmovable(true); movingPlatform.body.allowGravity = false; movingPlatform.setVelocityX(50);

but for Matter
it can’t use
movingPlatform = this.matter.add.image(200, 300, 'ground').setImmovable(true).setIgnoreGravity(true);

any idea??? thank

You can see how to use add.image in the Matter.Image documentation, I think you need something like this:

var platform = this.matter.add.image(200, 300, 'flectrum', null, { isStatic: true });

Btw I usually look at the code examples to see how it works, see the Phaser 3 Matter physics examples.

1 Like

Thanks,
but I want to develop a platformer game and create a moving platform , the moving platform can move left and right or horizontal vertical
If I set it isStatic, the platform can’t move completely…

Any solution of when the player on the moving platform( left and right or horizontal vertical), the platform is not be fall???
Thanks

if i set it isStatic: true
var platform = this.matter.add.image(200, 300, 'flectrum', null, { isStatic: true });

the platform can’t moving
update(){
this.platform.setVelocityX(4.6); //the platform can't moving
}

Ok I see, in that case instead of isStatic maybe try platform.setAllowGravity(false); (or platform.allowGravity = false; does the same thing)