Still have scaling issue on collisiontree

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Still have scaling issue on collisiontree

Postby arkeon » Sun Oct 19, 2014 8:37 am

Hi

I still have scaling issue on collision tree.
Here the video that show the behavior.

arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby arkeon » Wed Oct 22, 2014 4:51 am

I found a simple way to reproduce it in the ScaledCollision demo

in ScaledCollision.cpp just replace the code part in ScaledMeshCollision
Code: Select all
   DemoEntity teaPot (dGetIdentityMatrix(), NULL);
   //teaPot.LoadNGD_mesh("teapot.ngd", world);
   teaPot.LoadNGD_mesh("box.ngd", world);

   NewtonCollision* const staticCollision = CreateCollisionTree (world, &teaPot, 0, true);
   //   CreateScaleStaticMesh (&teaPot, staticCollision, scene, matrix, dVector (1.0f, 1.0f, 1.0f, 0.0f));
   CreateScaleStaticMesh (&teaPot, staticCollision, scene, matrix, dVector (0.5f, 5.0f, 3.0f, 0.0f));


you will see the box falling trough the static mesh
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby Julio Jerez » Wed Oct 22, 2014 12:57 pm

Ha good test, I will try tonight.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Still have scaling issue on collisiontree

Postby arkeon » Fri Oct 24, 2014 3:12 am

Were you able to reproduce the behavior ?
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby Julio Jerez » Fri Oct 24, 2014 7:40 am

I am testing now,
I see there is a problem yes, even wit the old demo.

I am checking what is happing. The Box is a much simple demo to debug that the tea pot, thanks
for that repro case.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Still have scaling issue on collisiontree

Postby arkeon » Fri Oct 24, 2014 7:42 am

you're welcome :) i'd like to be able to make a repro case like this with the "virtual call" thing;
I tried but I couldn't. :/
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby Julio Jerez » Fri Oct 24, 2014 10:35 am

Ok fixed, sync and try again please.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Still have scaling issue on collisiontree

Postby arkeon » Fri Oct 24, 2014 10:35 am

Great thanks!
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby arkeon » Fri Oct 24, 2014 10:38 am

you still have

Code: Select all
 DG_INLINE dgFloat32 dgCollisionInstance::GetBoxMaxRadius () const
 {
   //return m_childShape->GetBoxMaxRadius() * m_maxScale.m_x;
   return GetBoxMinRadius ();
 }


in the repository
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby arkeon » Fri Oct 24, 2014 10:45 am

It's ok for the sample from the video above, but I still have objects falling trough collision tree in an another one.

The Collision tree is more complex, and the object that pass trough is a compound collision generated using NewtonCreateCompoundCollisionFromMesh
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby Julio Jerez » Fri Oct 24, 2014 11:01 am

can you serialize the mesh that is falling trough the floor and try in the sand box,
if it fail then send to me for debugging, before make that change.

that is being like that for so long that I like to test first, I do no remember why I wrote like that
but is does seem like a big bug.
Please serialize the mesh form you app and see if you can test in the sand box.

what ever the bug is it has to be fixed.

also sync again, I made some small change to tat previous bug fix
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Still have scaling issue on collisiontree

Postby arkeon » Fri Oct 24, 2014 12:09 pm

Forget it for the mesh passing trough the collision tree.
The object have missing faces (this is an old static scene), I tough the collision shape would make this missing faces ignored but it seems it don't.

Tell me if this is not normal I will serialize the meshes.
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby arkeon » Fri Oct 24, 2014 12:13 pm

Oups no finally even with a mesh without missing faces it did it.
I'll try to reproduce in the newton demos.
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby arkeon » Fri Oct 24, 2014 2:11 pm

I got it in the sandbox :
binary files to unrar in the media folder : http://arkeon.be/scol/tree_debug_media.rar

To see the behavior drag the seat object over the ground surface, and it pass trough.

Here the code
Code: Select all
   // load the skybox
   scene->CreateSkyBox();
   NewtonBody* const body = CreateLevelMesh (scene, "flatPlane.ngd", true);

   dMatrix originMatrix;
   NewtonBodyGetMatrix(body, &originMatrix[0][0]);

   dMatrix camMatrix (dRollMatrix(-20.0f * 3.1416f /180.0f) * dYawMatrix(-45.0f * 3.1416f /180.0f));
   dQuaternion rot (camMatrix);
   dVector origin (originMatrix.m_posit);
   dFloat hight = 1000.0f;
   origin = FindFloor (scene->GetNewton(), dVector (origin.m_x, hight, origin .m_z, 0.0f), hight * 2);
   

   dVector location (origin);
   location.m_x += 20.0f;
   location.m_z += 20.0f;
   location.m_y += 10.0f;

   int defaultMaterialID = NewtonMaterialGetDefaultGroupID (scene->GetNewton());

   dMatrix matrix (dGetIdentityMatrix());
   matrix.m_posit = location;
   matrix.m_posit.m_x = 0.0f;
   matrix.m_posit.m_y = 5.0f;
   matrix.m_posit.m_z = 5.0f;
   matrix.m_posit.m_w = 1.0f;

  NewtonCollision* seatcol = 0;
   char pathName[2048];
   GetWorkingFileName ("seat.col", pathName);

  FILE* file = fopen(pathName, "rb");
   seatcol = NewtonCreateCollisionFromSerialization (scene->GetNewton(), DemoEntityManager::DeserializeFile, file);
   fclose (file);

  if (seatcol)
  {
    DemoMesh* const visualMesh = new DemoMesh(NewtonMeshCreateFromCollision(seatcol));
     for (int i = 0 ; i < visualMesh->m_vertexCount; i ++) {
        visualMesh->m_vertex[i * 3 + 0] *= 0.01;
        visualMesh->m_vertex[i * 3 + 1] *= 0.01;
        visualMesh->m_vertex[i * 3 + 2] *= 0.01;
     }
     // re-optimize for render
     visualMesh->OptimizeForRender();

    NewtonBodySetCollisionScale(CreateSimpleSolid(scene, visualMesh, 10.0f, matrix, seatcol, 0), 0.01, 0.01, 0.01);
    visualMesh->Release();
    NewtonDestroyCollision(seatcol);
  }

  NewtonCollision* groundcol = 0;
  matrix.m_posit.m_y = 2.0f;
  GetWorkingFileName ("ground.col", pathName);
  file = fopen(pathName, "rb");
   groundcol = NewtonCreateCollisionFromSerialization (scene->GetNewton(), DemoEntityManager::DeserializeFile, file);
   fclose (file);

  if (groundcol)
  {
    DemoMesh* const visualMesh = new DemoMesh(NewtonMeshCreateFromCollision(groundcol));
     for (int i = 0 ; i < visualMesh->m_vertexCount; i ++) {
        visualMesh->m_vertex[i * 3 + 0] *= 0.01;
        visualMesh->m_vertex[i * 3 + 1] *= 0.01;
        visualMesh->m_vertex[i * 3 + 2] *= 0.01;
     }
     // re-optimize for render
     visualMesh->OptimizeForRender();
    NewtonBodySetCollisionScale(CreateSimpleSolid(scene, visualMesh, 0.0f, matrix, groundcol, 0), 0.01, 0.01, 0.01);
    visualMesh->Release();
    NewtonDestroyCollision(groundcol);
  }

   origin.m_y += 10.0f;
   scene->SetCameraMatrix(rot, origin);
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Still have scaling issue on collisiontree

Postby Julio Jerez » Sat Oct 25, 2014 7:39 am

Ok, I see the problem,

The mesh has a hole, but that's not the bug, the bug is that the mesh mass trough the mesh even when standing over the right surface.

I am fixing this now this.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 2 guests

cron