Does anyone know how to prevent a gameobject from colliding with another gameobject but can still register collisions? Like a ball that can bounce off of the wall or ground and can pass through the player himself.
What I have tried: Creating two Colliders on the ball(which has a rigidbody component) and making one of them bigger than the other (and turn on "Is Trigger" on the bigger collider). Then write code in the OnTriggerEnter and the OnTriggerExit functions to disable/enable the smaller collider so that the ball could fly right through the player. But that is completely useless when the ball is not in motion and the player walks over it(because it'll fall straight down through the ground).