Ignore collisions with self but still trigger with self

I have a script which instantiates a bunch of objects called SPHERE. They are on a ballLayer which prevents them from colliding with each other, but they can still collide with the walls which are on the default layer. What I want is for them to still be able to trigger with each other as well. I’m not sure how I could go about this because if i set their collider to istrigger, then they no longer work with the unity physics engine. Any help would be appreciated.

Use Physics.OverlapCircle and then use a Rigidbody.AddForce once collided.

Here Check this out for Physics.OverlapCircle
And this for Rigidbody.AddForce

You could try adding a child object the sphere. Give the child object an identical collider but enable isTrigger and set it to the default layer.

Then you can check for triggers on the child object while collisions are handled by the parent.

The alternative solution would be to check if the ball is inside anything manually using Physics.OverlapSphere every FixedUpdate. Something like this:

void FixedUpdate()
    Collider[] colliders = Physics.OverlapSphere(rigidbody.position, radius, ballLayer);
    if (colliders.Length > 1)
        // More than one ball is inside the area, meaning this ball is overlapping another