Help: A collider attached to the character controller of a FPS does not collide

Hi all, I want to make a FPS and I have added a gun to the First Person Controller of the standard assets. I don't want the gun passes trough the walls, so I have attached a collider to the gun but it does not work.

I have found a similar post but I don't understand how to apply the solution,


For guns, there is a better way to do it. Add a second camera on top of your main camera that moves around with it.


  1. Set the depth of the second camera to 1, and the first 0.

  2. Create a new layer for your gun.

  3. In camera 2 set the culling mask to only your gun layer, and set the clear flags to depth only.

  4. In Camera 1, set the culling to all but the gun layer.

Now your gun will always be drawn on top of everything else so you don't have to worry about it clipping through the environment.