Hello! I have two bodies and I want to detect when they collide. I’m not sure if I should be using SAT but I decided to try using setOnCollideWith() from https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Matter.Components.Collision.html. Here is my code:
function create ()
{
cursors = this.input.keyboard.createCursorKeys();
let floor = this.matter.add.image(400, 600, 'floor', null, { isStatic: true }).setScale(2, 0.5).setAngle(8);
let mainCollisionCategory = this.matter.world.nextCategory();
floor.setCollisionCategory(mainCollisionCategory);
pogoStick = new PogoStick('pogo_stick_peg', 'player', this, this.matter, mainCollisionCategory);
pogoStick.lowerBody.setOnCollideWith(floor.body, collisionCallback)
}
function collisionCallback ()
{
console.log('collided');
}
The callback is never hit :(. Both pogoStick.lowerBody and floor.body are Matter bodies so I am unsure why this happening.
Anyone have any insight?