Trying to ignore collisions between certain prefabs, but in this case I don't want to use layers since these are specific object pairs that I want to not collide, and creating a layer for each prefab would complicate the layer matrix more than I want to.
What I tried so far:
public void OnCollisionEnter(Collision collision) {
if (collision.gameObject.tag == "Bullet") {
Physics.IgnoreCollision(collision.collider, collider);
}
}
So I tried ignoring the collision in the OnCollisionEnter
, but this only worked partially. The objects did go one through the other, but they both slowed down. My guess is that the first frame of the collision, the one that generated the call to OnCollisionEnter, was calculated regardless of the ignore command.
Any ideas how I can make all bullets not collide to one another, without putting them in a separate layer?
OnCollisionEnter
. \$\endgroup\$