Changing Collider Mask on Die Ability

polonel

Member
I'm trying to change the layer mask of an Enemy when they die. I have created a "Death" state that gets triggered when the die ability fires. It is actively changing the layer mask of the UCC Locomotion as I would expect. The issue I am facing is that my character still collides with the enemy while he's dead.

I have also tried the Character Health Script setting/changing the enemy layer to the death layer which my Player is set to not to collide with, but the collision still occurs. What am I doing wrong?
 
Last edited:
Does the collider change correctly? There are two sets of colliders, the main collider, and then the ragdoll colliders underneath the rig. By changing the layer within the health component it only changes the main collider. Maybe your character is colliding with the subcolliders that don't change?
 
Yes, I can confirm that the main collider is set to the death layer ("Dead Characters") and the rig colliders remain as SubCharacter. My character UCL collider mask is set to not collide with either. But it still collides and pushes the dead body around on the floor. It is definitely the main collider I'm colliding with because if I disable the Capsule Collider it's fine.


Dead Character CapsuleCollider GO
1603747295394.png

Dead Character Collision Mask in the "Death State"
1603747444532.png

Player Character Collision Mask
1603747486853.png

 
It might not make a difference, but just for safety can you double check your project's collision matrix and ensure your character's layer doesn't interact with the DeadCharacters layer?
 
Hm are you able to reproduce this in the demo scene? Also try manually setting the capsule collider to the "ignore raycast" layer just to test that layers are being ignored by collisions as expected...
 
This had to do with me setting the Character layer as a solid layer on the Enemy Character Layer Manager. When I removed the Character Layer it fixes the problem. No Collision upon death.
 
Top