Ignore Collision problem


Currently I’m having a problem with 3D collisions.

One of my player characters has the ability to melt into water and pass through other characters. How can I implement this?

The only option I found so far was doing a Physics.SphereCastAll with a large radius (eg. 100) and ignoring collisions for the resulting colliders. Then, as the ability ended, I’d restore collisions again. However, this seems terribly inefficient. Is there a better way to do this?

Hi @fa6ex, you can change the player’s layer at runtime via gameObject.layer = , then use the collision matrix to specify what layers collide with which other layers. Unity has some good documentation on this here: Unity - Manual: Layer-based collision detection