I'm making a platformer game in which there is player and some powerups. To check the collision I used matterjs collisionactive function:
this.matter.world.on("collisionactive", (e, o1, o2) => {
});
Inside the function, I need to remove the powerup from the game. So I tried o1.destroy , where o1 is the powerup. This did not work, and neither did it return a error. I also tried this.matter.world.remove(o1);. This did not work either. Why am I not able to remove the objects? Any help is greatly appreciated. Thanks!