Masklist - collision with which mask


(Wayne Makoto Sturdy) #1

With my testing so far it seems that all masks in a Masklist contribute to a single collision event of the Entity. I was wondering if it was possible to determine which mask in a Masklist is the one generating the collision.


(Ultima2876) #2

We had a similar thing in a game being developed by one of my team members. What we ended up doing was creating a separate entity called a ‘SpecialTarget’ (it’s a shooter) which has a ‘parent’ variable linking to the actual Entity it belongs to. Then when the SpecialTarget registers a collision, it triggers a callback in the parent entity. For example we have one SpecialTarget for headshots.

Not sure if that’s the best way to do it as it requires some other messing about such as making sure the ‘parent’ Entity removes the SpecialTarget when it is destroyed, but it definitely works and doesn’t cause any performance problems.


(Wayne Makoto Sturdy) #3

I was hoping to to find a way to achieve this as it would make things much simpler, but I was always prepared for having to use separate entities.