I'm using NewtonMeshCreateFromCollision to generate the visual objects from my collisions. Now I started using some compound collisions and realized, that there are no sub-meshes in the NewtonMesh. For each collision primitive in my compound, I use another shapeID (for different material properties), which works quite well. Now I want to have for each different shapeID in the compound a sub-mesh in the NewtonMesh, so I can iterate over it like that:
- Code: Select all
void* const meshCookie = NewtonMeshBeginHandle(collisionMesh);
for (int handle = NewtonMeshFirstMaterial(collisionMesh, meshCookie);
handle != -1; handle = NewtonMeshNextMaterial(collisionMesh, meshCookie, handle)) {
int material = NewtonMeshMaterialGetMaterial(collisionMesh, meshCookie, handle);
Where "material" should be the shapeIDs. However, the entire compound is in the sub-mesh with material=0. Is there a way to do that, or do I have to create a new NewtonMesh for each collision in the compound? If this is not possible, is there a way to get all NewtonCollisions in a compound?