Closed gabrielecaddeo closed 2 years ago
Contacts/MTDs are for box-box pairs are generated based on the pair of box geometries that have well-defined volumes, it can generate a valid MTD regardless of the configuration of the intersecting boxes (including one being fully contained by the other).
However, there is no volumetric information associated with a triMesh. It's just a set of triangles that form a shape - this shape could be closed (e.g. a box) or open (e.g. the surface of a ground). As we have no notion of volumetric information, a box made from a triMesh is effectively treated as a hollow shell of a box. As such, PhysX generates MTDs based on triangle-box intersections. These are really only well-defined when the COM of the box is on the positive side of the triangle's plane. If COM is on the negative side but touching the triangle, the triangle is culled. As such, there are many cases where a triangle mesh and box/convex equivalent would not generate the same MTD.
Thanks for your answer!
Hi, I am using the
Basically I am trying to use this query to compute the penetration between a Triangle mesh and a simple box. However, I see that sometimes the function return very different results if I am using 2 simple boxes or if I am using a simple box and a Triangle mesh. The triangle mesh is loaded using the code in the samples directory.
The green box can be either
PxGeometryQuery::computePenetration
with two boxes that are compenetrating (pose0
andpose1
), as the image below shows.box0
ortrimeshGeom
object. The red box is thebox1
. I attach here the code.This is the output of the code:
In this example, the function with the
trimeshGeom
does not return any compenetration. However, if I slightly change thepose0
for example in this wayPxTransform pose0(PxVec3(0.1, 0.0015, 0.1955));
then the code works perfectly. Can you give me some advice or explanation? Here is the code of theprism.obj
file