Hi,
I took as example a very basic snippet (hello world), and created a base ground:
PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial);
gScene->addActor(*groundPlane);
And a simple 1-unit size cube (as PxTriangleMeshGeometry) at height=5:
triangleMeshDesc.points.count = vCount;
triangleMeshDesc.points.stride = sizeof(PxVec3);
triangleMeshDesc.points.data = verts;
triangleMeshDesc.triangles.count = nbTriangles;
triangleMeshDesc.triangles.stride = 3*sizeof(PxU32);
triangleMeshDesc.triangles.data = indices
PxTriangleMesh* gTriangleMesh =gCooking->createTriangleMesh(triangleMeshDesc, phx->gPhysics->getPhysicsInsertionCallback());
if (!gTriangleMesh)
return;
PxTriangleMeshGeometry triGeom(gTriangleMesh);
PxTransform localTm(PxVec3(0,5,0));
PxRigidDynamic* body =gPhysics->createRigidDynamic(localTm);
if (!body)
return;
PxShape* triangleMeshShape = phx->gPhysics->createShape(triGeom, *gMaterial);
body->attachShape(*triangleMeshShape);
if (!triangleMeshShape)
return;
phx->gScene->addActor(*body);
triangleMeshShape->release();
I can properly run the simulation (series of simulate and fetchResults(true) and see the cube falling, but as soon as the cube touches the ground, the simulation crashes (maya plugin).
Using a simple pxBox geometry instead of my triangle custom geometry (triGeom) works fine. Is there anything specific I am missing above when cooking my geometry ?