/** * Keeps the given collider form colliding with this track and its adjacent tracks. * * Use this instead of Physics.IgnoreCollision or else a mesh regen will revert your change. * * Collisions are ignored until you unignore them. Ignoring a collider multiple times requires unignoring it * the same number of times to re-enable collisions. */ public void IgnoreCollisionsWith(Collider other) { ignoredColliders.Add(other); __ignoreCollisions(other, true); if (NextTrack) { NextTrack.RefreshIgnoredColliders(); } if (PrevTrack) { PrevTrack.RefreshIgnoredColliders(); } }
/** * Reverts IgnoreCollisionsWith for the given collider. */ public void ResumeCollisionsWith(Collider other) { if (NextTrack) { NextTrack.DisableIgnoredColliders(); NextTrack.RefreshIgnoredColliders(); } if (PrevTrack) { PrevTrack.DisableIgnoredColliders(); PrevTrack.RefreshIgnoredColliders(); } __ignoreCollisions(other, false); ignoredColliders.Remove(other); }