Disable collision between mesh collider and character controller

So I have a door and the standard fps controller and I can open the door, slerping it 90deg. I want to disable collision between the door and the player so that if the player is in the way when the door is rotating, the door goes through the player. The door has a mesh collider and a capsule collider trigger. I set a bool var when the door is activated and unset it if the door has reached a close angle/open angle.

So far, I’ve tried using physics.ignorecollision(), disabling the door’s mesh collider and even removing the collider component entirely when the bool var is set but nothing seems to work. I’m assuming the problem is in the way I’m rotating the door i.e. changing localRotation. Any help please?

In unity menu at the top, on Edit>Project settings>Physics you can find something called layer collision matrix. To avoid collisions create a layer called “Player” for your player and another called “Doors” (for example) and put all the doors in this second layer, then go to the layer collision matrix and uncheck the Player-Doors checkbox.

Why don’t you just disable the door’s mesh collider?

door.GetComponent<MeshCollider>().enabled = false;

~zedseven

Okay, I figured it out. I forgot that the door object had child meshes with colliders and changing the layer of the parent doesn’t affect the children. I updated the script to go through the children and change their layers and now it works fine.