Hi, I need to detect collision between two game objects but event when they ‘touch’ each other on screen, the collider callback doesn’t seem to work.
This is my code:
const move1 = setInterval(() => {
container1.x += 1;
}, 20);
const move2 = setInterval(() => {
container2.x -= 1;
}, 20);
this.gameInstance.physics.add.overlap(container1, container2,() => {
console.log('overlap detected..')
})
this.gameInstance.physics.add.collider(container1, container2, () => {
console.log('COLLISION DETECTED')
})