Mesh Collider with trigger but not convex in Unity5

I want to throw a ball at a mesh and detect its collision. It has to be quite accurate so a box collider won't suffice. In an older Unity version I just added a Mesh Collider with the flag "trigger" set and it worked perfectly.

With Unity5 I have to flag the collider as "Convex" in order to select "Is Trigger"... the problem is that now I get an error: Cooking::cookConvexMesh: user-provided hull must have less than 256 vertices! and it doesn't work anymore.

I can't reduce the number of vertices to less than 256... what can I do? Please help. :)

1 Like

I have a similar problem. Half of my game is based on big, almost flat surface and with physx 3.3 and disabled trigger for non-convex meshes, it just fall apart. I tried to split my mesh so it will have less than 255 vertices, but Unity converts my 255-vertices-mesh to even less triangle mesh and broke whole shape. I'm stuck as well :/.

Is there now even a possibility for check in for big, STATIC meshes, if they was touched? Raycast is not in play. It have to be events. OnCollisionEnter? Nope. Object needs to have ability to pass through mesh. Build whole collider from primitives? Good for small meshes, but what if mesh is really complex or just big? Yh....

Im building a racing game. and since i switched to unity 5 i have the same problem...
have you found a solution?

where can i find a document to explain to me how the new changes are effected and how to apply them?

Honestly how is anyone suppose to learn if just an error message is given, Seriously!!!!!!

ok so i found a work around. or whatever you want to call it. i came up with my own solution.

so when i loaded a low poly mesh this is what happens to the shell. it doesn't take the correct form, which i need it to, especially at the centre of the rocket rod.

2006776--129647--Screen Shot 2015-03-08 at 3.56.06 PM 1.png

here is what i did:
when you turn convex on it says you need a mesh of less than 256 vets. so i went into blender and broke the mesh apart. i then created two objects with mesh colliders on them and applied the new low poly mesh to it. because the shell is now broken in 2, the form is exact, well almost exact. anyway its very smooth, so in this case it might have saved me some memory.

2006776--129646--Screen Shot 2015-03-08 at 4.45.53 PM.png

Phew, quite some effort for something that used to work just fine. :/ I will see if I can do the same (my model has a lot of animation)... but thanks for sharing. ^^

your right and i do agree. but maybe we are missing something, maybe to do with the new version of the physics.

but out of all honesty it does optimise it way more.........way...........way more.

i have no idea how it will be effected with animations.
would you be so kind as to get back to me on your progress. and tell me how it effects your animations.

here is a youtube link that you can check the collisions with unity 5 using the convex thingy.

rock on!

have you had a chance to look at my solution? all you need to do is create a low poly mesh and just use that as the mesh for the collider. it will fit in it like a extra "shell" or thats what i call it.

anyway i hope it helps you

1 Like

Guys i made a video tutorial showing you exactly how i solved the problem

let me know if you get stuck anywhere


I have came up with similar solution. I tried to split my mesh, but i have to do it procedurally, and it does not work for me. In my game, my mesh is a big, high poly flat surface. Due i had to split my mesh following the triangles, in result i have got collection of straps. "Convexing" straps still was not very precision. I would have to split my mesh to rectangles, but my mesh have too irregular poly to do that.

Just today i have found different solution. We can use Collider.Raycast to determine distance between object and our "trigger". If Raycast return false (what basically means that distance is <=0) it had to be a touch event. The idea is to close our complex mesh in box or sphere collider and try Collider.Raycast on every object that stays in our primitive collider. Better our primitive fits the complex mesh, better performance we get.

1 Like

There is a plugin i use for concave meshes and it works well.. Concave Collider!/content/4596

1 Like

Alternatively you might want to check if that script can solve your trouble: