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 ;)