Closed FrankBolleri closed 4 years ago
Triangles are one sided- is the winding on the mesh reversed, making the non-colliding side point outward?
Also, I'm not entirely sure about your setup, but I strongly recommend against meshes colliding against meshes. Along with being slower than alternatives, it typically doesn't produce the expected behavior because triangles are infinitely thin. An infinitely thin triangle will fall through another infinitely thin triangle if they are coplanar. (v1 artificially inflated the triangles, in v2 the standing recommendation is to replace at least one of the meshes with a volumetric representation of some kind, like a convex decomposition.)
@RossNordby About not using meshes.,, what would you recomend for, let's say, a large environment? this is the typical case of a car driving over some authored track.
A large environment as a mesh is totally fine, and recommended. The problem arises when two meshes collide and stable resting contact is expected. Infinitely thin triangles just aren't good at that.
So as long as the car is not itself a mesh, there is no problem. Compounds of simple convexes, or autogenerated convex decompositions of meshes into convex hulls, will work just fine when colliding with meshes. (And they'll be a heckload faster.)
Thanks for your answer. In reality I am not so expert; I simply consider that generate a box using Box struct was equivalent to load a Mesh of a box when providing exactly same dimension but now I realize that things are not so simple. I will try to elaborate your indications and at the first chance to make some test I will try to study more in detail your suggestion.
Before close the issue, can you suggest me a way in V2 to "artificially inflate the triangles" similar to V1 approach? Is not clear to me if with "inflate" you mean to subdivide each triangle in n subtriangles (so made the structure more "dense") or scale it to make more bigger.
Thanks Francesco
By 'inflate', I mean every triangle collided with things within a small distance of the actual triangle, termed the collision margin. There's no easy way to do it in v2- I intentionally got rid of collision margins since they often have unintuitive effects (a v1 'box' is actually a rounded box in many pairs, for example).
There are ways I could improve mesh-mesh performance and behavior, but mesh-mesh pairs are sufficiently rare and avoidable that there isn't much reason to. Outside of a few special cases, even the 'improved' version would still be much slower than making the dynamic mesh a compound of convexes instead.
Notably, I would strongly recommend against mesh-mesh collision pairs even in v1. Or in any physics engine, for that matter. They're almost always going to be much slower than alternatives, like replacing the dynamic mesh with a compound of convexes with actual volume.
Thanks again for your answer and your patience. As I said, I am not an expert of CGI or physics - so I am sorry if my questions are very simplistic, but i have lack of theory beside these concepts.
Could you please point me on a section of V2 Demo where "replacing the dynamic mesh with a compound of convexes with actual volume" is done (if any)? Maybe if I see it in action, reading the code, I can understand better.
Have a nice day Francesco
The CompoundTestDemo has some examples of creating compounds of different kinds.
There isn't a demo showing a full automated mesh->convex decomposition into convex hulls pipeline, though. There are offline tools which can do it, like VHACD or other content tool integrations. With such a tool, you could output the convex pointclouds and load them in as compound-contained convex hulls at runtime.
Ok thank you very much. I will try to learn following your suggestions.
Have a nice week end. Francesco
Hello! Thanks for all your work! I am studying V2 and I am dealing with the following issue.
I create two Box bodies of same size 1x1x1 with the specific Box struct, the first Dynamic with position 0,0,10 and the second Kinematic 0,0,0; al is running in a Simulation with a PoseIntegratorCallbacks simulating 0,0,-10 of gravity. The first box fall correctly and stop on the top of the second box: good!!
But if I use a Mesh struct instead of Box struct, feeding triangles with the BufferPool as shown in DemoMeshHelper::LoadModel, the Dynamic box fall passing through the Kinematic box, like passing through a ghost :).
I am pretty sure to build the mesh correctly, because I am using the same approach working in the past with the V1 MobileMesh.
I don't know if this can be related, but I've noted that on the Dynamic one, when I use Box I have just "ComputeInertia" but when I use Mesh I have two versions: "ComputeOpenInertia" and "ComputeClosedInertia". In any case, calling CreateDynamic I've tested both, but without success :(
Do you have some suggestion? Thanks in any case Francesco