I’m spawning bullets inside the player.
The bullets are rigidbodies, and therefor I need to ignore the collision with the player.
This is exactly what the documentation says that Physics.IgnoreCollision is good for. I try and use it exactly like in the documentation:
Instantiate(pistolBullet, player.transform.position, player.transform.rotation);
Physics.IgnoreCollision(pistolBullet.collider, collider);
But when I do this, I get an error when I instantiate a bullet saying “Ignore collision failed. Both colliders need to be activated when calling this IgnoreCollision”.
I tried putting the code right after I instantiate, like shown here. But I also tried putting it in the awake of the bullet. But that didn’t help.
I’m not sure how it works, so I’d be greatly appreciative if I could get some help.
Thank you.