Unwanted Penetration While Rotating Objects!

Hi!
I’m using Unity since a few days ago and until now I found answers to my questions and problems by looking here and there on the community and on the documentation, but right now I have an issue that I’m truly unable to solve!
The problem is easy, here’s what I have:

  • A set of rigidbodies (tiles) with mesh colliders that compose a floor
  • An invisible panel that can be rotated via WASD, and that contains the tiles as childs (so they rotate too)
  • A crazy ball (simple sphere object) that rolls around as I rotate the panel
    Here’s what I get:
  • The floor is code generated by placing tiles one next to the other, so I can build editable maps, done and working
  • The floor rotation makes tiles rotate too, which is fine and working
  • The ball rolls correctly based on the current floor inclination
    Hers’s the problem:
  • When the ball is close to a distant edge of the floor, if I rotate too fast the ball penetrate through the floor and falls down!!!
    Here’s what I tried as solution:
  • Every object has a rigidbody
  • Every rigidbody is extrapolating (for interpolation)
  • Every rigidbody is in continuos dynamic collider detection
  • Every mesh collider has the smooth sphere collision on
  • The mass of the tiles is greatly higher that the mass of the ball
    I hope I have defined the problem as better as I could.
    Now, how can I fix this?
    Thanks for support! :smile:

I currently worked it around by reducing the rotation speed, but it’s not really what I would do in a normal situation… so really, no clues? ^^

Have you tried using primitive colliders (a cube) instead of mesh colliders for the tiles?

Thanks for the answer! :smile:
Actually I don’t, because my tiles are not flat, so I need a complex collider to detect for example half-pipes, small hills, and so on…
Are you saying I should convert the single mesh colliders with a lot of primitive colliders to fit the shape of my tiles?
Moreover, I get the same error without rotation if I let the ball fall from different altitudes, and I suppose it is due to the sphere collider passing beyond the mesh collider just before the collision test is made, so the problem is just the same as above.
What do you think about it?

How are you rotating the platform? You will have to apply torque to the appropriate rigidbody. If you rotate by setting transform.rotation, you are bypassing the physics system.

I feel pretty dumb now, never though about a torque instead of a simple rotation.
In fact I’m simulating a continuous rotation by changing it instatly with little transform.rotation one by one…
The problem now is that attaching a rigidbody to my platform returns the annoying error on mesh computing, even if the platform is a cube 1x1x1…
Actually the platform was born just as a “dummy container” to put in the tiles and make them rotate as it rotates, it is not a phisycal object that holds them, it is more a script and objects handler…
For the moment I’ve been able to bypass that physics problem even without the rigidbody and the torque, but I will surely work to implement it in the right way!
Thanks a lot for your answer then!

Yes, I feel your pain. I have a large space ship (futuristic aircraft carrier), and the mesh colliders are giving me the same sort of unwanted penetration. I would go to primitive colliders, but there is too much detail in the ship for that… Also, the ship is static. I have a jet that likes to find small cracks and go right through them…

Perhaps using “shell meshes” with no rendering component, and a mesh collider with “convex” checked. This would make the collision geometry much simpler, but detailed enough for many applications.