Help! Collision with PhysicBody when I use PhysicsEditor

In My Game, I shoot 1 bullet at 1 enemy. Each collision reduces the enemy’s blood by 1 blood.

tag1 = ObjA->getTag();
tag2 = ObjB->getTag();

if ((tag1 == tag_bullet)&&(tag2 == tag_enemy))
// reduce the enemy’s blood by 1 blood
if ((tag1 == tag_enemy)&&(tag2 == tag_bullet)
// reduce the enemy’s blood by 1 blood

When I use PhysicBody::createCircle or PhysicBody::createBox, the enemy will reduce 1 blood. But when I use PhysicsEditor, there will be a case where the enemy will reduce a lot of blood. Because at this time, PhysicBody is made up of many different PhysicBody.

Please, help me to solve this problem!

Maybe @AndreasLoew has thoughts. He is the author of PhysicsEditor.

Thank you very much!

@AndreasLoew. Please, help me.

I think you should set up bitmasks to decide what events to trigger and when and if you trigger them at all given circumstances.

I tried using bitmask. But no success. Can you tell more about your method.

I’m not sure how to describe my method. I just use bitmasks for each physics body and make decisions based upon comes into contact and triggers events. One of my games uses many physics bodies all brought together in code and if Object A touches Physics Body A, something happens. If Object B touches Physics Body A, perhaps nothing happens. But these bodies are all sort of stitched together to create my character.