- Home /
Can I ignore coliisons between a rigidbody and a collider?
I have objects that have a rigidbody component with IsKinematic set to true. Then I have other objects that do not have rigidbody components but do have colliders (I want the objects to pass through each other but still raise an event when they collide).
I capture this collision in the OnTriggerEnter function, and that works fine.
But I am unable to use Physics.IgnoreCollisions to ignore specific colliders as the the component with the rigidbody does not have a collider (and I'd rather not add one).
Is the only way to ignore collisions to add a collider component to it? Since the rigidbody still triggers the OnTriggerEnter function without one, it doesn't need an unnecessary collider component, so I was hoping there is a way to ignore that collision without adding the overhead of a collider (there are a lot of these objects of various shapes so just having a rigidbody without a collider is far more efficient).
Another note, at the moment I have solved the issue by having a (fairly large) set of checks at the start of the OnTriggerEnter function so that it does not process the collisions it shouldn't, but again this seems wasteful as it is raising the event and doing a bunch of checks every single time... so I'm not really happy with that solution either.
Answer by madks13 · Jul 05, 2018 at 01:34 PM
Just set up your layers properly and it should work fine.