I have spent time tonight studying the IgnoreCollision function but I can’t figure it out in relation to what I’m trying to do…
I have ten prefab balls of different colours. My scene creates randomly coloured balls, a random number of times, so sometimes you’ll have five balls, ten balls, fifty balls, etc. I have other objects in the scene that I want the balls to collide with, and they do perfectly. But I don’t want the balls colliding with each other, I want them to pass through and overlap each other.
can anyone give me some pointers on how to achieve this? I’m sure I’ll have to use the IgnoreCollision function but how exactly do I proceed?
What’s your current usage for method IgnoreCollision and your configuration in terms of objects layers and layer matrix collision?
Since it’s properly defined what kind/type of objects should collide with eatch other, you should rely on the layer collision matrix:
In the above screenshot (Unity - Manual: Layer-based collision detection), objects from layer 1, 2 and 3 will collide with objects in the same layer but won’t collide with an object from another layer.
In your case, I think you should define a certain layer for your balls (layers can be renamed) and another one for other objects according to the following:
Then you should apply layer “Ball” to your prefabs and layer “Other” to your other gameobjects: