The PhysicsPicker of JME Physics 2 fails to pick objects based on QuadMeshes.
The reason is that pickVisual() makes the follwing check
if ( data.getTargetTris() != null && data.getTargetTris().size() > 0 )
where a QuadMesh does not have target tri meshes. A possible fix would be to check for
if ( data.getTargetMesh() != null ) instead.
This does work in my program but I am not aware of possible negative consequences.
The code is:
private void pickVisual() {
pickResults.clear();
pickResults.setCheckDistance( true );
rootNode.findPick( pickRay, pickResults );
loopResults:
for ( int i = 0; i < pickResults.getNumber(); i++ ) {
PickData data = pickResults.getPickData( i );
if ( data.getTargetTris() != null && data.getTargetTris().size() > 0 ) {
Spatial target = data.getTargetMesh();
while ( target != null ) {
if ( target instanceof DynamicPhysicsNode ) {
DynamicPhysicsNode picked = (DynamicPhysicsNode) target;
attach( picked );
break loopResults;
}
target = target.getParent();
}
}
}
}