[SOLVED] Debug collision geometry?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[SOLVED] Debug collision geometry?

Postby ep1stle » Fri Nov 07, 2008 9:18 pm

Hey folks,

I just wanted to ask you if someone can provide me a snippet which allows me to display the collision geometry. I got it working with 1.53, but since I changed to 2.0 BETA 12 the code won't compile anymore.

Old code
Code: Select all
void CGame::DebugShowGeometryCollision (const NewtonBody* body, int vertexCount, const float* faceVertec, int id)
{
   int i;

   i = vertexCount - 1;
   vector3df p0 (faceVertec[i * 3 + 0], faceVertec[i * 3 + 1], faceVertec[i * 3 + 2]);
   for (i = 0; i < vertexCount; i ++)
    {
      vector3df p1 (faceVertec[i * 3 + 0], faceVertec[i * 3 + 1], faceVertec[i * 3 + 2]);
      irrDriver->draw3DLine(p0,p1);
       p0 = p1;
   }
}

void  CGame::DebugShowBodyCollision (const NewtonBody* body)
{
   NewtonCollisionForEachPolygonDo (body, DebugShowGeometryCollision );
}


Any help would be appreciated,
thx in advance
Last edited by ep1stle on Sat Nov 08, 2008 6:01 pm, edited 1 time in total.
ep1stle
 
Posts: 10
Joined: Mon Nov 27, 2006 12:38 pm
Location: GERMANY

Re: Debug collision geometry?

Postby Kapitan » Sat Nov 08, 2008 4:48 am

You have to see in the new Newton.h what are the params
of NewtonCollisionForEachBodyDo...not only 2.

(and the compiler says it).
Kapitan
 
Posts: 37
Joined: Thu Apr 17, 2008 6:07 pm

Re: Debug collision geometry?

Postby ep1stle » Sat Nov 08, 2008 5:21 am

Well, of course I know that there have to be more params, but I have no clue what to set for NewtonCollisionIterator* and void* useData in order to get it working.
ep1stle
 
Posts: 10
Joined: Mon Nov 27, 2006 12:38 pm
Location: GERMANY

Re: Debug collision geometry?

Postby Julio Jerez » Sat Nov 08, 2008 11:54 am

dowload the lastest beta, and check the file util, ther are one or tow working funtions.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Debug collision geometry?

Postby Kapitan » Sat Nov 08, 2008 12:02 pm

The NewtonCollisionIterator is your callback, the userdata is a pointer
to same of your custom data.
Kapitan
 
Posts: 37
Joined: Thu Apr 17, 2008 6:07 pm

Re: Debug collision geometry?

Postby ep1stle » Sat Nov 08, 2008 6:00 pm

Thanks for your help. After one hour of porting my app to BETA17 it finally works like a charm ;)
ep1stle
 
Posts: 10
Joined: Mon Nov 27, 2006 12:38 pm
Location: GERMANY


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 17 guests