package applets.picker; import shout3d.*; import shout3d.core.*; public class Picker4Panel extends Shout3DPanel implements DeviceObserver { Picker myPicker; Node[] pathToPick; String name = "CONE"; TimeSensor timer; public Picker4Panel(Shout3DApplet applet) { super(applet); } public void customInitialize() { myPicker = getNewPicker(); addDeviceObserver(this, "MouseInput", null); timer = (TimeSensor) getNodeByName("TIMER"); } protected void finalize() { removeDeviceObserver(this, "MouseInput"); } public boolean onDeviceInput(DeviceInput di, Object userData) { MouseInput mi = (MouseInput) di; if (mi.which == MouseInput.DOWN){ pathToPick = myPicker.pickClosest(mi.x,mi.y); //if something intersected if (pathToPick != null) { //get geometry node at end of Node array MultiMesh mesh = (MultiMesh) pathToPick[pathToPick.length-1]; //test DEF name String test = mesh.getDEFName(); if ( test.equals(name) ) { timer.start(); } return true; } //if nothing intersected return false; } return false; } }