Unity3D prevent objects collision

unity3d prevent objects collision

There is a simple way of handling collisions physics in Unity3D. All you need to be done before is to set correct values to object’s Layer field.

There is a feature called Layer Collision Mask in Unity3D. It works for both 2D and 3D modes. To access the collison mask go to Edit > Project Settings > Physics (or Edit > Project Settings > Physics2D for 2D mode). It will open the PhysicsManager setting in the Inspector tab:

unity collision mask

Prevent collision between layers

Here you can see the layer collison mask with checkboxes. Each checkbox is responsible for detecting collisions between 2 game layers (first is vertical, second is horizontal). For example:

  • The first checkbox in the top left is responsible for collisions between layers Default and Skills.
  • The next one is responsible for collisions between Default and Background layers
  • and so on…

So, to prevent collision between layers just disable a checkbox that represents this layers collision on the mask.

Leave a Reply

Be the First to Comment!