I feel so stupid…
public void handleKeyboardInput(int keyInput) {
double ANGLE_INCR = 5.0;
double SPEED = 0.5;
switch (keyInput) {
case KeyEvent.VK_RIGHT:
leftRightAngle += ANGLE_INCR;
break;
case KeyEvent.VK_LEFT:
leftRightAngle -= ANGLE_INCR;
break;
case KeyEvent.VK_UP:
CameraX += xStep * SPEED;
CameraZ += zStep * SPEED;
break;
case KeyEvent.VK_DOWN:
CameraX -= xStep * SPEED;
CameraZ -= zStep * SPEED;
break;
case KeyEvent.VK_A:
upDownAngle += ANGLE_INCR;
break;
case KeyEvent.VK_Z:
upDownAngle -= ANGLE_INCR;
break;
}
updateCamera();
}
public void updateCamera(){
xStep = Math.cos( Math.toRadians(leftRightAngle));
zStep = Math.sin( Math.toRadians(leftRightAngle));
CameraLookX = Math.cos( Math.toRadians(leftRightAngle)) * LOOK_AT_DIST;
CameraLookZ = Math.sin( Math.toRadians(leftRightAngle)) * LOOK_AT_DIST;
CameraLookY = Math.sin( Math.toRadians(upDownAngle)) * LOOK_AT_DIST;///?????????????
}
How do I get, the CameraLookY to work based on angles? This is driving me insane…