Ejemplo n.º 1
0
 public void move() {
   calculateZoom();
   calculatePitch();
   calculateAngleAroundPlayer();
   float horiztonalDistance = calculateHorizontalDistance();
   float verticalDistance = calculateVerticalDistance();
   calculateCameraPosition(horiztonalDistance, verticalDistance);
   this.yaw = 180 - (player.getRotY() + angleAroundPlayer);
 }
Ejemplo n.º 2
0
  public void move() {
    if (cameraMode == CameraMode.OVERHEAD) {
      if (KeyboardHelper.isKeyDown(Keyboard.KEY_LEFT)) {
        this.position.x -= OVERHEAD_CAMERA_MOVE_SPEED * DisplayManager.getFrameTimeSeconds();
      }
      if (KeyboardHelper.isKeyDown(Keyboard.KEY_RIGHT)) {
        this.position.x += OVERHEAD_CAMERA_MOVE_SPEED * DisplayManager.getFrameTimeSeconds();
      }
      if (KeyboardHelper.isKeyDown(Keyboard.KEY_UP)) {
        this.position.z -= OVERHEAD_CAMERA_MOVE_SPEED * DisplayManager.getFrameTimeSeconds();
      }
      if (KeyboardHelper.isKeyDown(Keyboard.KEY_DOWN)) {
        this.position.z += OVERHEAD_CAMERA_MOVE_SPEED * DisplayManager.getFrameTimeSeconds();
      }

      this.yaw = 0;
      this.pitch = 70;
      this.position.y = world.getTerrain().getTerrainHeight(position.x, position.z) + cameraHeight;

    } else if (cameraMode == CameraMode.FIRST_PERSON) {
      Vector3f viewPos = player.getHardpointWorldPos("HP_VIEW");
      if (viewPos == null) viewPos = player.getPosition();

      this.position.x = viewPos.x;
      this.position.y = viewPos.y;
      this.position.z = viewPos.z;
      this.pitch = player.rotX;
      this.yaw = 180.0f - player.rotY;
    } else if (cameraMode == CameraMode.THIRD_PERSON) {
      calculateZoom();
      calculatePitch();
      calculateAngleAroundPlayer();

      float horizontalDistance = calculateHorizontalDistance();
      float verticalDistance = calculateVerticalDistance();
      calculateCameraPosition(horizontalDistance, verticalDistance);
    }
  }
Ejemplo n.º 3
0
  public boolean move() {
    Vector3f oldPos = new Vector3f(position.x, position.y, position.z);
    float oldPitch = pitch;
    float oldYaw = yaw;
    float oldRoll = roll;
    boolean hasMoved = false;
    calculateZoom();
    calculatePitch();
    calculateAngleAroundPlayer();
    float horizontalDistance = calculateHorizontalDistance();
    float verticalDistance = calculateVerticalDistance();
    calculateCameraPosition(horizontalDistance, verticalDistance);
    this.yaw = 180 - (player.getRotY() + angleAroundPlayer);

    if (oldPos.x != position.x
        || oldPos.y != position.y
        || oldPos.z != position.z
        || oldPitch != pitch
        || oldYaw != yaw
        || oldRoll != roll) hasMoved = true;

    return hasMoved;
  }