MeshCollider (concave) doesn't trigger OnCollision functions

Hello guys,

I searched at Google and I’m very suprised that nobody mentioned about MeshCollider (concave) doesn’t support for method “OnCollision”. So I’ll ask here:

I’ve there a problem with MeshCollider. The problem is that MeshCollider (concave) will not trigger on OnCollisionEnter (but convex/other collider works fine). It looks like that MeshCollider in concave doesn’t support in OnCollisionEnter or I’m wrong?

If I’m wrong, how I can find out if the point is inside of mesh (concave + convex)? The calculation should be fast (good for performance, optimized). I’m using very few poly (low poly) for mesh.

I can’t use convex because I need to find out if a point is inside of mesh, in convex and even in concave.
I can’t also use trigger from meshcollider, because the trigger works only in convex.
I can’t use multiple convex mesh to make it “fake”-concave mesh (like this: https://www.assetstore.unity3d.com/en/#!/content/4596), because I need raycast “triangleIndex” which it doesn’t work in convex.

Does anybody have a idea?

Thanks,

  • Chinafreak

It’s not so much that there isn’t a method for concave, but that it’s not supported in PhysX: https://docs.unity3d.com/Manual/UpgradeGuide5-Physics.html

Thanks for the fast answer! Yes I know that about PhysiX is not possible anymore. But I thought it was for dynamic object. Is there no way to check if point is inside of mesh which its good for performance? I’m not using dynamic object for meshcollider. :confused:

Convex can’t hit another convex collider since one of them needs to be concave and have a rigidbody.
In other words a complex/concave static environment can still interact with convex rigidbody items.
I guess you want 2 concave items to collide?

Thanks for reply!
@Pengocat well one is MeshCollider (static body) and one is SphereCollider (dynamic body). So no, I’m not using 2 concave items to collide.

And the Rigidbody is non-Kinematic? Unity - Manual: Introduction to collision

@Pengocat Yep, is non-Kinematic. Like I said, OnCollision triggers all Collider (include MeshCollider Convex) expect the MeshCollider in Concave.

Hmm… I am running out of ideas sorry.

1 Like

No worries, thanks for the try! :slight_smile:

I did some meshcollider vs sphere collider testing and found they will usually collide with a couple exceptions.

is kinematic meshcollider vs is kinematic sphere collider will not collide
is kinematic meshcollider vs sphere collider with no rigidbody will not collide

Make sure at least one object has a rigidbody attached.