SharedMesh and triangle collision

I use SharedMesh objects and I 'd like to do triangle collision detection with a main object… But I cannot get back the triangles which collide when I get a collision with a SharedMesh.



I call updateCollisionTree() on the target mesh, and rootNode contains some instances of SharedMesh.



Here is my collision detection code (it works for all nodes except SharedMesh) :


      results.clear(); // results = TriangleCollisionResults instance
      spaceShip.findCollisions(rootNode, results);
      
      if (results.getNumber() > 0) {
         for (int i = 0; i < results.getNumber();i++) { // bounding box collision detection
            CollisionData data  = results.getCollisionData(i);
              
            if (data.getTargetMesh().hasCollision(data.getSourceMesh(), true)) { // triangle accuracy collision detection
               if (!mobile.hasCollide()) {
                  ArrayList triangles = data.getTargetTris(); // here I get an empty array for SharedMesh objects

                  // physics stuff
               }
            }
         }
      }



I guess I have made a mistake somewhere... Any help welcomed ;)

as nobody else seems to have a clue, either:



I would recommend using data.sizeOfTargetTris() > 0 instead of doing collision detection for those two meshes again (findCollisions already does this for TriangleCollisionResults). But that's only a performance issue. Can't see why that code should not work :expressionless:



Have you checked TestOBBTree for differences?