NewtonCreateCompoundCollisionFromMesh tolerance

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

NewtonCreateCompoundCollisionFromMesh tolerance

Postby arkeon » Wed Sep 17, 2014 4:13 am

Hi !


in NewtonCreateCompoundCollisionFromMesh the tolerance parameter is not used and forced to 0.01f, this should be replaced by hullTolerance.

Code: Select all
NewtonCollision* NewtonCreateCompoundCollisionFromMesh (const NewtonWorld* const newtonWorld, const NewtonMesh* const convexAproximation, dFloat hullTolerance, int shapeID, int subShapeID)
{
   TRACE_FUNCTION(__FUNCTION__);
   NewtonCollision* const compound = NewtonCreateCompoundCollision(newtonWorld, shapeID);
   NewtonCompoundCollisionBeginAddRemove(compound);

   NewtonMesh* nextSegment = NULL;
   for (NewtonMesh* segment = NewtonMeshCreateFirstSingleSegment (convexAproximation); segment; segment = nextSegment) {
      nextSegment = NewtonMeshCreateNextSingleSegment (convexAproximation, segment);

      NewtonCollision* const convexHull = NewtonCreateConvexHullFromMesh (newtonWorld, segment, hullTolerance, subShapeID);
      if (convexHull) {
         NewtonCompoundCollisionAddSubCollision (compound, convexHull);
         NewtonDestroyCollision(convexHull);
      }
      NewtonMeshDestroy(segment);
   }

   NewtonCompoundCollisionEndAddRemove(compound);

   return compound;
}
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: NewtonCreateCompoundCollisionFromMesh tolerance

Postby arkeon » Wed Sep 17, 2014 4:42 am

Less sure about this one but in dgMeshEffect::CreateConvexCollision

in case of fail I ran into a crash on collision Release
It seems the collision in some case is not valid at all.
Code: Select all
   if (!collision->GetConvexVertexCount()) {
      collision->Release();
      return NULL;
   }


hoo found it ^^
m_vertexToEdgeMapping is not initialised to 0 in dgCollisionConvexHull

add ,m_vertexToEdgeMapping(0) in all dgCollisionConvexHull contrstructors
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: NewtonCreateCompoundCollisionFromMesh tolerance

Postby Julio Jerez » Wed Sep 17, 2014 7:45 am

wow, yes two important bugs,
fixed already sync.
very good catch, thank you

I am glad you are using the newton mesh, It is very powerful utility for mesh manipulations.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateCompoundCollisionFromMesh tolerance

Postby arkeon » Wed Sep 17, 2014 8:32 am

hehe you're welcome :)

sorry but I just use this function to generate a compound collision from a collision tree to make a sort of concave bodies.
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: NewtonCreateCompoundCollisionFromMesh tolerance

Postby arkeon » Wed Sep 17, 2014 9:35 am

Just saw that m_sentinelBody on world is not initialized ether.

in dgWorld and dgWorldDynamicUpdate too
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: NewtonCreateCompoundCollisionFromMesh tolerance

Postby Julio Jerez » Wed Sep 17, 2014 9:53 am

they are initialized on the body of the constructor function.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateCompoundCollisionFromMesh tolerance

Postby arkeon » Wed Sep 17, 2014 9:55 am

it's always safer to initialize them from the origin class :)
this just I saw some 0xccccccc in the debugger on this classes when trying to understand why the dvector Floor is crashing
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 8 guests