So I have a group and I want to detect when in it collided with the world bounds. The problem is that worldbounds
event is never fired. What should I add to make it work? My code below:
const b = globalScene.add.rectangle(300, 300, 20, 20, 0x32cd32);
snake = globalScene.physics.add.group({
collideWorldBounds: true,
});
snake.add(b);
Also I have this function which is running on update
export const detectCollideWithWorld = () => {
globalScene.physics.world.on(
'worldbounds',
() => console.log(123),
globalScene,
);
};