Search Unity

How to make an object only collide with certain layer?

Discussion in 'Scripting' started by half_voxel, Mar 4, 2008.

  1. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    well the title of this thread says it all.
     
  2. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    You cannot do layerMask filtering with colliders, so therefore, you can't decide on collisions based on layers. been needing this myself for ages, but it's not possible.

    You can set the Ignore Physics Collisions to call objects that are NOT in that layer by making a collection of the game objects not in that layer, and iterating through them finding their colliders and ignoring them..... yes, I agree, a Yuck solution.