PDA

View Full Version : Java 3D, PickCanvas not working on Mac




kaffekopp
Aug 29, 2008, 04:41 AM
I have made a little java3d program. This was made on a PC (working fine there). Now i want to use the program on Mac aswell, the problem is that object picking using PickCanvas doesnt seem to work here.
(PickCanvas is located in j3dutils.jar -> com.sun.j3d.utils.picking.PickCanvas)

My mouseclick/picking method looks something like this:

public void mouseClicked(MouseEvent event) {
if ((event.getModifiers() & InputEvent.BUTTON1_MASK) != 0){
// Left mousebutton clicked:
pickCanvas.setShapeLocation(event);
PickResult result = pickCanvas.pickClosest();

if (result != null) {
// A 3D object has been mouseclicked
Primitive prim = (Primitive) result.getNode(PickResult.PRIMITIVE);

//...
}
}
}

On PC\windows the program detects a PickResult when I click on a 3d object, no problem there. But on Mac, the variable "result" is always "null" when i click on a 3d object.. why?


Need help! :confused: