- Home /
How to stop meshes from penentrating each other
I have a couple of different shapes, and for a while now I couldn't get their physics to work properly. They are using the Cube mesh, but for reasons I had to use a meshcollider, and not the boxcollider. That just for clarification though, at least theoretically it shouldn't be part of the problem.
First, this is how it looks:
They sit comfortably like this, no incentive to change. What you cannot see in the screenshot is, that z-movement and x- and y- rotation are disabled for them, the rest is displayed. Feel free to ask if there is something additional you want to know. Has anyone ever had a similar problem, where meshes are partly submerged into each other?
What are their position at the start of the scene ?
All the boxes share the same mesh collider ?
Try to delete the 2 boxes for the right, copy/paste the left one and position it the way you like to see if is there anything weird happening with the 2 right boxes.
BTW, why do you need to use mesh collider? :)
$$anonymous$$alachiteBR
1: I position them by drawing them with the mouse. In this case, the two one the bottom were drawn pretty much where they are now, and the submerged one was draw above them. It proceeded to fall , and ins$$anonymous$$d of properly colliding, the thing you are seeing happened.
2: Yes all boxes have a Cube mesh and a meshcollider using the cube mesh.
3: I don't really understand.. I can delete and copy them just fine, I tried it right now and I didn't see anything weird, but as I say, I might just misunderstand what you mean.
4: When I use the box collider, the act as if they were made out of jelly. They wobble around and never come to rest. I used meshcollider to avoid that bug, but I got a new one ins$$anonymous$$d.
The left box seems to collide fine, thats why I said for you to clone it.
You could try to play with gravity settings, together with rigidbody settings, increasing/decreasing gravity, mass, drag and etc... So the box collider would work as you intended.
The physics works great, but you will have to properly set it up.
I tried out a couple of things, and I found out something new: They don't penetrate each other on all sides, just two of the four. This is really strange, I have no idea why that would be the case. I ticked the box for convex hulls as collider, so there should be no way that an object with 8 vertices such as this box should be penetrable at any point, but apparently there is.
$$anonymous$$alachiteBR
I tried playing around with the physics and rigidbody settings as well, but to no avail.