/* (non-Javadoc) * @see com.jme.input.action.MouseInputAction#performAction(float) */ public void performAction(InputActionEvent evt) { shotTime += evt.getTime(); if (MouseInput.get().isButtonDown(0) && shotTime > 0.1f) { shotTime = 0; Ray ray = new Ray( camera.getLocation(), camera.getDirection()); // camera direction is already normalized PickResults results = new BoundingPickResults(); results.setCheckDistance(true); scene.findPick(ray, results); hits += results.getNumber(); hitItems = ""; if (results.getNumber() > 0) { for (int i = 0; i < results.getNumber(); i++) { hitItems += results.getPickData(i).getTargetMesh().getName() + " " + results.getPickData(i).getDistance(); if (i != results.getNumber() - 1) { hitItems += ", "; } } } shots++; results.clear(); text.print("Hits: " + hits + " Shots: " + shots + " : " + hitItems); } }
@Override protected void initializeState() { MouseInput.get() .setHardwareCursor( ClientApplication.class .getClassLoader() .getResource(ECursorState.TryingToMove.getIconLocation())); this.buildGUI(); }