Need help with selective collision detection
Posted: Fri Jul 05, 2019 3:06 am
I'm having a heck of a time trying to figure out how to code the logic in this engine for selective collision detection. Here's the basic thing I'm after:
* The player should be able to collide with enemies and items, but not their own projectiles
* The enemies should be able to collide with the player, items, and the player's projectiles
* Items should be able to collide with the player and enemies, but not player projectiles
* Player projectiles should only collide with enemies
* Player, enemies, items, and player projectiles should not collide with menu icons
I've tried to figure out how to make this work with categories and masks, but it seems like that particular system is either very buggy or just not well-documented. All of these things set to the same category will refuse to collide with each other if I set any value at all for a single mask, even if each value is distinct. However, if I set 2 mask values for them, they will all collide with each other no matter what those mask values are. There seems to be no middle ground: either everything hits everything or nothing hits anything.
Any help is much appreciated!
* The player should be able to collide with enemies and items, but not their own projectiles
* The enemies should be able to collide with the player, items, and the player's projectiles
* Items should be able to collide with the player and enemies, but not player projectiles
* Player projectiles should only collide with enemies
* Player, enemies, items, and player projectiles should not collide with menu icons
I've tried to figure out how to make this work with categories and masks, but it seems like that particular system is either very buggy or just not well-documented. All of these things set to the same category will refuse to collide with each other if I set any value at all for a single mask, even if each value is distinct. However, if I set 2 mask values for them, they will all collide with each other no matter what those mask values are. There seems to be no middle ground: either everything hits everything or nothing hits anything.
Any help is much appreciated!