Stop object collision

I’ve made an invisible wall cube that stops the player passing through an area. Is there any way that I can make a different object able to pass through the the cube while still blocking out the player?

Thanks for any help

  • Max

Yes, take at look at Unity’s Layer-Based Collision Matrix. It sounds a bit complicated, but it is actually really easy and it will fulfill your requirements.

Use layers: create two new layers - PLayer and Obstacles, for instance - and place the player in PLayer, and the wall in Obstacles. In the Collision Matrix, uncheck collisions in the crossing Default x Obstacles - this will make all objects in Default layer ignore collisions with the anything in Obstacles. Take a look at my answer to this question - it shows a more detailed sequence to achieve this effect.