NewtoMesh and Compound Collision

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtoMesh and Compound Collision

Postby Markus » Thu Jun 02, 2011 1:39 pm

Hey,

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?
Markus
 
Posts: 52
Joined: Sat Mar 19, 2011 6:31 am

Re: NewtoMesh and Compound Collision

Postby Julio Jerez » Thu Jun 02, 2011 5:57 pm

you can use GetInfo on the compound collision, then for each subcollion add then faces to the meshEffect.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron