package applets.picker; import shout3d.*; import shout3d.core.*; public class Picker2Panel extends Shout3DPanel implements DeviceObserver { Picker myPicker; Node[] pathToPick; public Picker2Panel(Shout3DApplet applet) { super(applet); } public void customInitialize() { myPicker = getNewPicker(); addDeviceObserver(this, "MouseInput", null); getScene().setDEFName("ROOT"); } protected void finalize() { this.removeDeviceObserver(this, "MouseInput"); } public boolean onDeviceInput(DeviceInput di, Object userData) { MouseInput mi = (MouseInput) di; if (mi.which == MouseInput.DOWN){ myPicker.setPickInfo(Picker.POINT, true); myPicker.setPickInfo(Picker.NORMAL, true); pathToPick = myPicker.pickClosest(mi.x,mi.y); //if nothing intersected if (pathToPick==null) { System.out.println("");//blank line System.out.println("Nothing Intersected"); } //if something intersected else { System.out.println("");//blank line //get intersection point float [] point = myPicker.getPickInfo(Picker.POINT); //print out intersection point System.out.println( "Intersection point is (" + point[0] + ", " + point[1] + ", " + point[2] + ")" ); //get normal at intersection point float [] normal = myPicker.getPickInfo(Picker.NORMAL); //print out normal System.out.println( "Normal vector at intersection point is (" + normal[0] + ", " + normal[1] + ", " + normal[2] + ")" ); //print out path for (int i=0; i