Filtering

Is it possible to filter collisions by ID without incurring a call to OnTrigger/Collision?

Like say:

only objects with ID 1 collide with each other, ignore all other ids
only objects with ID 2 collide with each other, ignore al other ids

I know people are handling this inside of OnTrigger/Collision - I’m wondering if it’s possible without the overhead incurred by the function call & any internal processing

Edit → Project Settings → Physics
Use the checkboxes to allow/disallow collision
between layers.

  1. Set up some layers
  2. Give your rigidbodies the desired layer (top section of Inspector pane)
  3. ???
  4. Profit

No functions, no overhead. Very clean actually :slight_smile:

1 Like

this forum appears to be broken. someone answered this a few days earlier but their answers are not showing here. I can see them if I click my Alerts. weird

Ohh I see it now… there is a double posting down the list.