Colliders with the shape of the mesh

Hi there,

I am currently trying to achieve an animation with two cogs engaging with each other, so that I can use colliders and a rigidbody to make a cog rotate when engaging with a already rotating one.

It seems to me that the mesh is not being recognized by the collider although I made the cogs within blender and just imported the .blend-file. It also seems to me that holes in colliders are not really holes as it collides with my rod aswell.

What am I doing wrong?

Try using a compound collider and set it to…isKinematic.
Make the compound colliders in such a way, that it follows the circumference/circular path of the cog.
And leave the center of it blank, with no collider. So that the rod, could easily go through it.
Use a donut shape as an example.:sunglasses:

If you haven’t read this article yet, check the gun pic part of this info.

They talk about Compound colliders.
Enjoy!:sunglasses:

Hi Brandy,

thanks for your reply!
But why doesn’t it work like that:


?

Note: the right cog is constraint so that it can only rotate on the z-axis.

I am animating the cog on the left, along with a mesh collider attached, and the one on the right has both a mesh collider and a rigidbody (kinematic) attached to it. Unfortunately, the right one doesn’t react to the corresponding rotation of the one on the left and that one simply passes through.

Is there a limitation of the physics engine?

Oh, so you’re using a mesh colliders. Alright then.

Okay, does the cog on the right, have convex enabled or checked?

If not, enable convex, so that it’ll interact, with other mesh colliders.:sunglasses:
Note: The only catch, is that if you enable the convex option, on the cog object with the rigidbody, it has to have about
255 triangles limit.

And it might not be able to construct the shape correctly. The convex mesh might not be the right shape (probably won’t be is more accurate) as your cog isn’t able to be described by a single convex shape. So this is bad advice.

Convex shapes are very particular. They cannot be any shape. A cog is mostly concave.

What you want is to construct the compound collider with separate primitives or separate convex colliders you import.

A compound collider is generated by placing a rigidbody on the parent, and having several child colliders without rigidbodies on their own gameobjects. You’ll have to do it manually, using box colliders etc, but it will work and you’ll be able to have accurate dynamic physics.

Only static physics can be mesh colliders which are not convex. Please look up the differences between convex and concave. In future, Unity is interested in automating the process for multiple convex colliders so that they will be able to together, describe a complex mesh collider.