/** * <code>performAction</code> rotates the camera about it's up vector or lock axis at a speed of * movement speed * time. Where time is the time between frames and 1 corresponds to 1 second. * * @see com.jme.input.action.KeyInputAction#performAction(InputActionEvent) */ public void performAction(InputActionEvent evt) { incr.loadIdentity(); if (lockAxis == null) { node.getLocalRotation().getRotationColumn(1, tempVa); tempVa.normalizeLocal(); incr.fromAngleNormalAxis(-speed * evt.getTime(), tempVa); } else { incr.fromAngleNormalAxis(-speed * evt.getTime(), lockAxis); } node.getLocalRotation() .fromRotationMatrix(incr.mult(node.getLocalRotation().toRotationMatrix(tempMa), tempMb)); node.getLocalRotation().normalize(); }
/** * Rotate a node by the current setting of incr matrix * * @param node The node to rotate */ private static void rotateByIncr(Spatial node) { node.getLocalRotation() .fromRotationMatrix(incr.mult(node.getLocalRotation().toRotationMatrix(tempMa), tempMb)); node.getLocalRotation().normalize(); }