- Home /
Use IgnoreCollision and IgnoreLayerCollision together?
Hi,
Is it possible to use these two together? I'm setting my two objects to two different layers and use IgnoreLayerCollision so they don't collide with each other but under some circumstance I want one or two of those to collide with the other layer again.
I tried it but it didn't work so I may be missing something.
What I did is what I described and then when one of them enters a trigger, I put IgnoreCollision with that object and some colliders that are in layer that is in that IgnoreLayerCollision but it seems IgnoreLayerCollision has a higher priority.
Am I missing or it's the way things are in Unity?
I basically want to ignore that Layer with IgnoreCollision.
Thanks!
Answer by sparkzbarca · Nov 19, 2012 at 03:49 PM
just use a 3rd layer. :P
layer 3 is the SOMETIMES layer. It includes both objects from the different layers and is used as the collision layer in the event you want them to collide.
so
object A is part of layer A and Layer C
object B is part of layer B and Layer C
Layer C is used as the collision layer when you want collisions between them.
Mark as answered and have a nice day. :)
You do realize that one object cannot be part of more than one layer, right?
really? nope didn't know that. I haven't used collision layers. Seems kinda abitrary but im don't know how codewise the layering system works so I guess maybe its needed?
I just figured it was some kind of if object.layer == layer i'm looking for, its a hit, else cast through the collider.
Your answer