Congratulations on defending your diploma, and welcome to the club smile

I'm very grateful for your wrapper and I admire your dedication. I need only very small parts of the Newton's features and although your wrapper uses many advanced features, it unfortunately lacks the ability to add WED blocks collision tree (from my experience). I read your comment above newton_treecollisionaddentity():

Quote:
(note: if you would like to add WED blocks as static collision geometry then you have to pass NULL to ent_getmesh and loop through all blocks! the transformation to world space isn't necessary then.)


so I've done the following:

WARNING! THE FOLLOWING CODE IS INCORRECT!

1) I've changed the
void newton_treecollisionaddentity(NewtonCollision* treecollision, ENTITY* entity)
to
void newton_treecollisionaddentity(NewtonCollision* treecollision, ENTITY* entity, var argnum)

2) Inside the newton_addstaticcollisiongeometry(), after building collision tree for models, I've addded this loop:
Code:
var num = 0;
while ( (ent_getmesh(NULL, num, 0) != NULL) )
{
   newton_treecollisionaddentity(treecollision, NULL, num);
   num ++;
}



3) I've modified newton_treecollisionaddentity() to the following:

Code:
void newton_treecollisionaddentity(NewtonCollision* treecollision, ENTITY* entity, var argnum)
{
   var num = 0; 
   if(!entity) 
   {
      num = argnum;
   }
	
   LPD3DXMESH pmesh = (LPD3DXMESH)ent_getmesh(entity, num, 0);
   /* ... */

   if (entity)
   {
   //transform
   }
   else
   {
    // don't transform? 
     // add triangles to collision tree
      for(i = 0; i < numfaces; i++)
      {	
         float v[9];
         v[0] = pvertices[pindices[(i*3)+2]].x * QUANTTOMETER;
         v[1] = pvertices[pindices[(i*3)+2]].y * QUANTTOMETER;
         v[2] = pvertices[pindices[(i*3)+2]].z * QUANTTOMETER;
         v[3] = pvertices[pindices[(i*3)+1]].x * QUANTTOMETER;
         v[4] = pvertices[pindices[(i*3)+1]].y * QUANTTOMETER;
         v[5] = pvertices[pindices[(i*3)+1]].z * QUANTTOMETER;
         v[6] = pvertices[pindices[(i*3)+0]].x * QUANTTOMETER;
         v[7] = pvertices[pindices[(i*3)+0]].y * QUANTTOMETER;
         v[8] = pvertices[pindices[(i*3)+0]].z * QUANTTOMETER;
         NewtonTreeCollisionAddFace(treecollision, 3, v,12,   pattributes[i]);
         }
   }
/* ... */
}



Unfortunately it doesn't work, and the blocks are passable, as if a transformation was needed after all. The problem is that I need a transformation matrix (ent_getmatrix), but of course it only accepts ENTITY*. I could create my own transformation matrix, by setting pan, tilt and roll to 0, but what about x,y,z ? Can I get it somehow for the static blocks?
Could I ask you (or anybody else) for some help with this?

Last edited by EnjoMitch; 06/19/09 09:52.