It is interesting that I am not using “PhysX Debug Visualization” but the gVisualizeTouchedTris flag had a value of “true”. I searched the flag and it looks like it is always true. So maybe it is a miss I think.
I am not aware of this specific bug but it is strange that gVisualizeTouchedTris is true. It’s an internal debug tool so I suspect it has been set to true by accident before a release, at some point. I suggest setting it to false. I will do that in our trunk ASAP.
Meanwhile I will also try to reproduce this bug, but it doesn’t happen in our internal tests so far.
I suppose it can only happen when the array is empty. Could you check that when it happens for you, touchedMesh->mNbTris is 0 ?
In that case the fix would be either to test touchedMesh->mNbTris as well before calling visualizeTouchedTriangles, or maybe replace &getTriangle(0) with some other function like begin(). I will do one or the other and submit this to our trunk.
P.S. I tested moving CCT to a height field’s back face by my test program of PhysX 3.4.1 and it works well. So maybe the reason of assert is my code, not the PhysX’s.
I tested for other situation and I found another bug that may relate to the question above.
When I drop a rigid dynamic(with geometry of sphere or convex mesh) to a height field which have grids for specific tesselation flags, assert of GuPCMContactMeshCallback.h line 164 will take an error.
Thanks for reporting the assert in GuPCMContactMeshCallback.h. That assert is assuming a particular tessellation format, which you aren’t using. The assert is confirming that the adjacent triangle shares an edge and coming to the conclusion that the vertices it expects to be shared are not shared.
Feel free to comment out or ignore that assert as it is incorrect. We will fix it up in a future release. The actual code computing the edge activity flags is correct, it is just the assert that is not correct.
But by the way, I found that in the header “GuHeightField.h”, the triangles’ index writed in the comment around line 774 and line 829 are different from the PhysX user guide.
// <---- COL
// 0----2 1 R
// | 1 / /| O
// | / / | W
// | / / | |
// |/ / 0 | |
// 1 2----0 V