Hello forum, I’m having this issue with matter, I’m trying to activate and deactivate collision between 2 bodies, but something weird is happening, here is a video.
https://www.youtube.com/watch?v=SJPSKnvPXr4
Phaser Version: 3.18.1
Here is the code, is this the expected result? How can I achieve dynamic collisions or what is the right way to do this?
var config = {
type: Phaser.AUTO,
width: window.innerWidth,
height: window.innerHeight,
backgroundColor: 0xffffff,
physics: {
default: "matter",
matter: {
debug: true
}
},
pixelArt: true,
roundPixels: false,
antialias: false,
scene: {
create: create
},
scale: {
zoom: 4
}
};
var game = new Phaser.Game(config);
var platform;
var ball;
function create() {
var self = this;
platform = this.matter.add.rectangle(100, 46, 40, 10, {
isStatic: true,
isSensor: true
});
ball = this.matter.add.circle(100, 8, 6, {
isStatic: true
});
this.input.on("pointerdown", function() {
self.matter.body.setStatic(ball, false);
platform.isSensor = false;
});
}
Thanks in advance!