Practical examples of mesh collider work arounds?

I’m new to Unity. I have read through documentation and forums but haven’t found a precise answer to my scenario below so please be kind!

I’m making a VR game with objects players need to be able to interact with in a precise (down to the millimeter) way. For a player to be able to pick up and interact with objects they need to have rigid bodies and colliders (interaction script requires it). I can’t use basic colliders as the player requires the objects to collide with each other in very price ways. Imagine a cylinder facing vertically upwards and a torus being placed over the cylinder very carefully so that the cylinder only just fits in the torus’ central hole without touching the sides. Convex is therefore not possible.

Obviously I can use multiple basic shaped colliders but I’d need so many of them to create an accurate shape of the inside of the torus that I suspect performance would be too poor, especially for a VR game.

My question on the above scenario is, am I missing something obvious? Are people really making tons of basic collider shapes for animated characters, or a space ship flying through a tight space between a hole in an asteroid? Can anyone provide practical examples of how they have solved this problem without a labour intensive workflow? There are so many examples where one would need precise collisions on objects I feel I must be missing something stupidly obvious?

Many thanks for your help in advance. I’ve tried to solve this myself but have hit a brick wall.


In case anyone else stumbles across this question and wants to know the answer… here is the best I could come up with myself.

The short answer is, yes you do have to manually add lots of primitive colliders when you’re looking for precise collisions on a complex mesh. However, compound colliders are a reasonable solution for me at least (link to the manual Rigid body). Ignoring the labour intensive manual work-flow, it’s worth keeping in mind that compound colliders make multiple primitive colliders less of a problem for performance… certainly less of a problem than lifting the 250 vert mesh collider limit would have if Unity allowed it.

After creating a torus and manually rotating and transforming lots (95) box colliders so the torus’ faces were all covered, collisions are spot on. Though I had to double this number so I could have one set of colliders as triggers (playing an audio clip) and then a second set as non-trigger colliders so that the parent torus collides physically, rather than passing through other game objects. This is because I only wanted to play the audio if a particular gameobject tag was colliding, trigger colliders don’t physically collide and OnCollisionEnter is passed the Collision class and not a Collider. i.e I couldn’t see a way to find out the object tag of the object colliding with the torus through OnCollisionEnter. This may be me needing to brush up on C# though.

In any case, it ended up being a lot of colliders needed for one game object! I couldn’t find any change in frame-rate though, so I stopped worrying about performance.

This discussion on collider issues is also worth reading.

For anyone else making VR games and wanting to speed up the work-flow, I’d recommend keeping an eye on the Unity 5.6 beta. The VR editor looks awesome.