Triangle mesh creation : how to specify material indices ?


How to get the index of a material so that I can provide the index list to the PxTriangleMeshDesc ?


You must provide the material indices to the PxTriangleMeshDesc. The material indices are an array of 0 base indices that index into the array of material used to create the shapes for the triangle mesh actor. If you look at PxRigidActor::createShape, it takes a PxGeometry object and an array of PxMaterial. This method will be eventually used to create the shapes for the triangle mesh actor after cooking the triangle mesh based on the PxTriangleMeshDesc. So you have to know upfront what material each shape of the triangle mesh will consist of, and provide indices into that array to the PxTriangleMeshDesc.

Thank you very much

You are welcome, the documentation for the SDK though decent, takes some figuring out sometimes.