-
-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no collision with mesh colliders #258
Comments
Meshes are composed of triangles and triangles are one sided; collisions on the backface of a triangle go through. By the way, standard recommendation is avoid mesh-mesh collisions. They're expensive and, because triangles are infinitely thin, will struggle to generate good contacts with each other when approaching resting states (two infinitely thin planes will just slip through each other). Avoid meshes in dynamics whenever possible for this reason. |
Yes i tried both directions, and both have the same problem. I managed to get the manually generated tetrahedron to collide by making the floor thicker. I am surprised that 0.1 is not enough, the speed was not that great. A simple cube mesh loaded from file also works if the floor is thicker. However a slightly more complex mesh does not work, no matter what I do. |
The original code has inconsistently wound triangles; the bottom face is flipped from the other faces. When I run it on master with consistent windings, it works as expected. The other more complex meshes may have inconsistent windings. Note that a triangle parallel to the surface of a box, falling onto a box, with a box thickness of 0.1, requires high contact stiffness to stop the collision from allowing more than 0.05 units of penetration because triangles are infinitely thin. The common demos setting of 30hz frequency, 1 damping ratio, and 2 maximum recovery velocity is not stiff enough to handle that. Increasing the maximum recovery velocity and frequency may help, though be advised that it can be harder to solve that kind of stiffness in complex constraint systems (like lots of objects in a tall stack). It may require more iterations, a faster timestep frequency, or substepping. |
Yes, It worked when I did this again with correct winding. Also I increased the floor to 2.0f Now only compounded shapes of meshes fall through, is that not allowed?
Or is that problematic in some way because I add the shape to the simulation twice? |
Compounds can only refer to child shapes which have been added to the (I explicitly disallowed compound nesting because you're generally better off performance-wise flattening the hierarchy. I don't do that flattening automatically in the library because nonoptional "magic" stuff almost inevitably backfires. Technically, this means you don't get boundary smoothing of
Not sure I understand the use case here. |
dang it >_< Okay, does it say that anywhere? I just assumed it works because the method signatures allow it. Also no warnings. I don't have a specific use case for anything yet, just building it into our engine. Can you promt some kind of warning for that case? Now(2.3) it appears to just ignore that and have no collisions.
Yes, I pass the CollidableDescription around. I was just not shure about it, because in order to create it, the shape must be added to the sim, while in this example the shapes are added directly (https://github.com/bepu/bepuphysics2/blob/v2.3.0/Demos/Demos/CompoundTestDemo.cs: 37+38). So I assume they will then be added by the builder. |
I don't remember when they were added, but the latest version does have a couple of forms of validation. Pretty sure 2.3 had some validation for this (though 2.3 is old). Note that some validation is only active when running in debug mode with source.
Yes, it's a very simple and shallow convenience function. |
Hi, I am un 2.3.4 I tried to folow the MeshTestDemo.cs (and DemoMeshHelper.cs) as close as possible. My problem is that my MeshColliders do not collide with BoxColliders, the BoxColliders collide with each other and all Bodies fall down (gravity works).
I created a minimal example in form of a tetrahedron
The whole thing adds a lot like graphics, I extracted all I find that is relevant.
Any idea, why the bodies with mesh colliders fall through the static box collider floor (all bodies with box colliders work)? Any pitfalls that I might have stumbled over?
The text was updated successfully, but these errors were encountered: