Like I said in the title, is there any way to recreate the ignorecollision method for 2d objects without the use of layers? Layers are certainly the easiest solution, but since they’re limited, it’s not the optimal.
Let’s pretend that I got a bucket that will “catch” objects randomly falling down throught the scene, those objects need to collide with the bucket’s “floor” but not with each others, how would you do this ? I didn’t actually found anyway to make it, even with the use of isTrigger / collider.enabled properties… any Idea ?
Well, if you do not need to recreate real world physics. Ex ball fals, collides with other ball, both balls bounce away at various trajectories, then just use Trigger,
void OnTriggerEnter(Collider col){
if(col.CompareTag("ball")
return;///do nothing.
else if (col.CompareTag("bucket"){
explode();
}
}
If the 30 or so layers are not enough, I would question your games architecture. Certainly you can condense everything down into enough layers.
Yeah I also believe that 30 layers should be enough but let’s just assume that they aren’t, I need to ignore the collision of the same objects, so that they can stay alltogheter “inside” the bucket, without colliding with each others and fall out consequantially, and I can’t find no actual way to do this with isTrigger property / ontriggerenter function
Well, once they as in the bucket, why do you need to monitor collisions? Can’t you just turn off colliders at that point? I would assume the objects would be invisable.
Also, of it because you want to track the objects in the bucket. Make a list. As objects enter the bucket, add them to the list.
yeah I basically want them to move with the bucket as soon as it moves too, that’s why adding objects to the list would not be enough efficient… i’ll probably stick with layers and that’s it.