Is there a way to make collision layers like in Maya?
For example, I want object A to collide with anything (layer 0)
Object B, C, D can’t collide with each other because they are on separate collision layers.
Is there a way to make collision layers like in Maya?
For example, I want object A to collide with anything (layer 0)
Object B, C, D can’t collide with each other because they are on separate collision layers.
I think its possible.
But this is how I will do that:
Lets say the object where this script is attached is D
function OnTriggerEnter(other : Collider){
if(other.transform.name == "A"){
Debug.Log("Collided");
} else if(other.transform.name == "B"){
Debug.Log("Object was B");
} else if(other.transform.name == "C"){
//. . .
}
// and so on...
}
Hope it helps you
Unless I’m mistaking this will only give a condition if it collides with another one. What I need is a way that to make sure that the collision will only happend with selected objects.
In Maya when an object is on collision layer 0 it will collide with anything. Objects in collision layer 1 will only collide with each other. Same for objects in layer 2 and so on. But objects in layer 1 don’t have any effects on objects in layer 2, 3 etc.
I believe someone once posted a collision manager. Look for it on the forums or the wiki.
There is not at this time anything that Unity provides to handle this automatically. No built in collision groups or layers. You can do it however, by cycling through and calling physics.ignorecollision() on all the appropriate colliders when you spawn the objects.
There is also a current vote set up for it on the wishlist. Certainly go vote for it, as it’s something that would be of great benefit.