No collider while door is opening!

I use code to open a door in fps game.the door and code is ok.but i don’t know why collider is not working.in other woed,when the character is near the door and door is opening,the door isn’t collider with character.

My character has character controll.i don’t use of animation.the code use of transform and rotation.

Hi Karafs,
you want to detect collision in code or you want to just stop rotation of door / stop moving character further.

  1. To detect collision one of the object should have a rigidbody. if your game have more-then one door, its good to apply rigidbody on your character
  2. If you are using Character Controller Component, then you need to use void OnControllerColliderHit(ControllerColliderHit hit) {} method to detect Collision. Character Controller not detect Collision with normal methods like OnCollisionEnter(), OnCollisionExit(), OnCollisionStay().