Can you 'layer mask' all physics? (Solved.)

Imagine this situation:

Your scene has 200 everyday colliders of different types.

However it has say 10 “special” colliders, which you only use for certain calculations. Let’s say their tag is “VerySpecial”

When you do Raycasting, you can of course easily cast onto only those colliders, using a layer mask, or indeed, you can cast on to all the normal colliders, using a layer mask, or indeed you can cast on to both, as you wish.

#However

If you leave the “VerySpecial” colliders enabled all the time, then, they will interact as part of the physics in the scene.

My current solution: I tediously disable all the VerySpecial colliders at start-up.

Whenever I need to use them in a physics frame, I quickly enable all the VerySpecial colliders, and then do my happy calculations.

Then, I quickly disable all of those VerySpecial colliders once more - and back to the normal flow of time.

Sorry if this is a lame newbie question - what’s the solution?

Alternately, is there some way to (at least) disable/enable all my VerySpecial colliders all at once, perhaps by tag? What’s the deal?

In short … how to make the

Physics layer completely ignore

one group of colliders? Thanks!

Thanks for everyone’s help :slight_smile:

I realised this is 100% taken care of by Unity.

It is completely handled by the layer-colllision-model “triangle of tick boxes”…

http://unity3d.com/support/documentation/Components/Layer%20Based%20Collision%20detection.html
http://unity3d.com/support/documentation/Components/class-PhysicsManager.html

Hope it helps someone.