示例#1
0
 /**
  * <code>performAction</code> moves the camera along it's negative direction vector 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) {
   Vector3f loc = camera.getLocation();
   if (!camera.isParallelProjection()) {
     loc.subtractLocal(camera.getDirection().mult(speed * evt.getTime(), tempVa));
   } else {
     // move down instead of backward if in parallel mode
     loc.subtractLocal(camera.getUp().mult(speed * evt.getTime(), tempVa));
   }
   camera.update();
 }
 /**
  * <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();
 }
 /**
  * <code>performAction</code> moves the camera along the negative left vector for a given distance
  * of speed * time.
  *
  * @see com.jme.input.action.KeyInputAction#performAction(InputActionEvent)
  */
 public void performAction(InputActionEvent evt) {
   Vector3f loc = node.getLocalTranslation();
   loc =
       loc.addLocal(
           node.getLocalRotation().getRotationColumn(0, tempVa).multLocal(-speed * evt.getTime()));
   node.setLocalTranslation(loc);
 }