/**
  * <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();
 }
Beispiel #2
0
 /**
  * Rotate a node around one of its axes
  *
  * @param node The node to rotate
  * @param localAxisIndex The index of the local axis around which to rotate
  */
 public static void rotate(Spatial node, int localAxisIndex, float angle) {
   incr.fromAngleNormalAxis(
       angle, node.getLocalRotation().getRotationColumn(localAxisIndex, tempVa).normalizeLocal());
   rotateByIncr(node);
 }