I tried to do collision and I found how to do that.
I used OnTrigger functions. but I dont know how to distinguish box collider and mesh collider.
as I try, distinguishing my object’s collider is if(MeshCollider) or if(BoxCollider)
but I dont know find the other object’s collider.
if(other.gameObject.collider == MeshCollider) is not work.
I’m noob on unity scripting T.T.
plz teach me.
Your question isn’t really clear what exactly you want to do. Do you want to distinguish a collider based on the type of the collider? That sounds a bit strange to me.
Usually you want to check some of the unique properties like the objects name:
if(other.name == "MyObject")
But if you really want to check the type of collider you can do this:
//UnityScript
if (other.GetType() == BoxCollider)
//C#
if (other.GetType() == typeof(BoxCollider))
This is ment to be used in OnTrigger (Enter / Leave / Stay) with a Collider parameter called “other”