TestTrianglePick – cannot access triangle data

Hi,



I am new to JME, but have been using it for the past few days and loving it so far.



I have manually created a TriMesh object and I am now trying to pick individual triangles within in. I can pick the mesh using PickData.getTargetMesh(), but for some reason PickData.getTargetTris() always results zero, despite TrianglePickResults.getNumerber() returning more than zero.



I noticed this to also be the case in the TestTrianglePick demo provided with JME. For example, I have posted a few lines I have added to the bottom of the demo to try and get which triangles have been picked.





[java]







results.clear();



maggie.calculatePick(mouseRay, results);



//I have added this bit to TestTrianglePick.java. It always prints out an empty triangle int array,

//despite results.getNumber() showing there are results.

for (int i = 0; i < results.getNumber(); i++) {

PickData hit = results.getPickData(i);

System.out.println("Hit: " + hit.getTargetTris() + “(” + hit.getDistance() + “)”);



}

[/java]



Thank you very much,



Toshi

Solved, by just iterating through every triangle in the mesh once I have picked the mesh using getTargetMesh().



Thanks.