Crash when using NewtonCollisionCollide function

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Crash when using NewtonCollisionCollide function

Postby kane7777 » Wed May 05, 2010 7:55 pm

Hi,

I am using the latest version of Ogre3d 1.7.1 and Newton SDK 2.20 and I am facing some problem when I use the NewtonCollisionCollide function. Whenever I check the collisions between two compound collisions using this function, the program will crash when the compound collisions collide against one another. I have tried using this function with two convex collisions and it works very well without any error. I have not tried checking this with a convex collision against a compound collision.

Any advice is greatly appreciated!
kane7777
 
Posts: 8
Joined: Wed May 05, 2010 7:42 pm

Re: Crash when using NewtonCollisionCollide function

Postby Julio Jerez » Wed May 05, 2010 8:16 pm

It should no crash I will check that out tonight.

To make it eassy do you have a test, I can try?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash when using NewtonCollisionCollide function

Postby kane7777 » Thu May 06, 2010 11:07 am

Sorry for the late reply. Basically I have two tanks in the game and I want to do manual collision checks whenever I rotate the turret or barrel (move the mouse to rotate them). Whenever I try to rotate the barrel or turret to collide against the other tank, the program will crash. The manual check function can be found in OBattle class, CollisionCollide function.

The program will crash when I do manual collision checks between 2 compound collisions.

Kindly refer to download link below:
http://rapidshare.com/files/384220199/Demo1.zip.html
kane7777
 
Posts: 8
Joined: Wed May 05, 2010 7:42 pm

Re: Crash when using NewtonCollisionCollide function

Postby Julio Jerez » Thu May 06, 2010 12:07 pm

Ok I have the demo, very cool.

I can not figure out how to trun to get close to teh sucudn vehicle? how do to it?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash when using NewtonCollisionCollide function

Postby kane7777 » Thu May 06, 2010 8:45 pm

You may press W to accelerate, S to reverse and A / D to rotate the tank. F8 can be pressed to show the
Newton debug lines and text.
kane7777
 
Posts: 8
Joined: Wed May 05, 2010 7:42 pm

Re: Crash when using NewtonCollisionCollide function

Postby Julio Jerez » Fri May 07, 2010 9:35 am

Ok I try this and I see teh crash.
who ever it si crashing in soem wird place, I am guessing that it is soem stack overrun, but I can no see anythong because many funtion do not have debug information.

can you make a debug build, to make is easier to debug?
I tryied but you are using Ogre 7 and I am not going to go there now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash when using NewtonCollisionCollide function

Postby Julio Jerez » Fri May 07, 2010 9:56 am

In the Coumpoind collision demo of the SDK, i pasted a test code to test NewtonCollisionCollide
Code: Select all
   // create the visual shape
   OGLMesh* geo;
   geo = new OGLMesh("coumpound", compound, "wood_0.tga", "wood_0.tga", "wood_1.tga");

   dMatrix matrix (GetIdentityMatrix());
   for (int i = 0; i < xCount; i ++) {
      x = origin.m_x + (i - xCount / 2) * spacing;
      for (int j = 0; j < zCount; j ++) {
         dFloat mass;
         NewtonBody* body;
         RenderPrimitive* node;
         
         z = origin.m_z + (j - zCount / 2) * spacing;

         mass = 1.0f;
         // create a simple primitive
         matrix.m_posit.m_x = x;
         matrix.m_posit.m_y = FindFloor (system.m_world, x, z) + 5.0f;
         matrix.m_posit.m_z = z;
         body = CreateGenericSolid (system.m_world, &system, "compound", mass, matrix, size, _SPHERE_PRIMITIVE, defaultMaterialID);

         // make a compound collision
         NewtonBodySetCollision (body, compound);


         // now make a visual representation to match the collision shape
         node = (RenderPrimitive*) NewtonBodyGetUserData (body);
//         node->RemoveMesh(node->m_meshList.GetFirst()->GetInfo().m_data.GetFirst()->GetInfo());
         node->RemoveMesh (node->GetMesh());
         node->AddMesh(geo);

         dVector origin;
         dVector inertia;
         NewtonConvexCollisionCalculateInertialMatrix (compound, &inertia[0], &origin[0]);   
         inertia = inertia.Scale (mass);
         NewtonBodySetMassMatrix (body, mass, inertia.m_x, inertia.m_y, inertia.m_z);

         dVector com (0.0f, -1.0f, 0.0f, 0.0f);
         NewtonBodySetCentreOfMass (body, &com[0]);


#if 1
                  // test NewtonCollisionCollide with compound collisions
         int count;
         dMatrix matrixA (matrix);
         dMatrix matrixB (matrix);
         matrixA.m_posit.m_y += 1.0f;
         matrixB.m_posit.m_z += 0.0f;

         dVector contacts[20];
         dVector normals[20];
         dFloat depths[20];
         NewtonCollision* collisionB = NewtonBodyGetCollision(body);
         count = NewtonCollisionCollide (system.m_world, 10, compound, &matrixA[0][0], collisionB, &matrixB[0][0], &contacts[0][0], &normals[0][0], &depths[0], 0);
         _ASSERTE (count);
#endif

      }
   }

and it seem to work fine.

Make the debug build I beleive something is wrong eithe in Ogre News, of teh apply but I can no test OgreNewton because the version in SVS link to Ogre 1.6 and the version you have link to 1.7
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash when using NewtonCollisionCollide function

Postby kane7777 » Fri May 07, 2010 11:49 am

Thanks! I will try to work out on the debug build.
kane7777
 
Posts: 8
Joined: Wed May 05, 2010 7:42 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest

cron