How not to decrease life when shooting raycast on a sheld/gun

One of my enemies has a shield for defence, but when i shoot at it, the enemy looses life nonetheless. I think because the shield is parented to the bone of the enemy’s arm.

I tryed giving a “life” script to the shield, so it would loose life but not the enemy himself. Both lost life (haha).

I’m thinking about unparenting the shield but changing it’s position on FixedUpdate() so it will look like parented. I didn’t feel like changing positions like this would be ideal, so i thought asking for advice before doing it.

An alternative solution might be to alter your health script. If you know they have a shield (or its active) you can block the incoming damage in that script or reduce it. :slight_smile:

1 Like