Hi, guys, I’m working with a particleSystem and I want to handle it on a globalCollision with a dynamic body and the particle system, but i can’t find the way to do it, i usually use this Runtime:addEventListener( “collision”, onGlobalCollision ) but for particle systems i found that i must use this : Runtime:addEventListener( “particleCollision”, onGlobalCollision ) but it seems to make slow the performance … my question is, is there a way to handle both in one handler?
Hi @osiel,
Is your game design basically like “one main object/player/character colliding with multiple things”? Or is it a “many things potentially colliding with many other things”? If it’s the first way… like one main object… then I almost always recommend using “local” collisions instead of “global”. It’s just much easier to manage and handle what’s happening in the game IMHO.
Anyway, for your scenario, you could probably try to rig up one listener for both global collisions and particle collisions, but it would be tricky to code it that way, and potentially confusing with a bunch of conditional statements inside to detect which type of collision occurred. I’d stick with using a dedicated particle collision function if possible.
Best regards,
Brent
Hi @osiel,
Is your game design basically like “one main object/player/character colliding with multiple things”? Or is it a “many things potentially colliding with many other things”? If it’s the first way… like one main object… then I almost always recommend using “local” collisions instead of “global”. It’s just much easier to manage and handle what’s happening in the game IMHO.
Anyway, for your scenario, you could probably try to rig up one listener for both global collisions and particle collisions, but it would be tricky to code it that way, and potentially confusing with a bunch of conditional statements inside to detect which type of collision occurred. I’d stick with using a dedicated particle collision function if possible.
Best regards,
Brent