Esempio n. 1
0
 public void processKeyboard() {
   if (isKeyDown(GLFW_KEY_W)) position = position.add(getLookVector());
   if (isKeyDown(GLFW_KEY_S)) position = position.add(getLookVector().negate());
   if (isKeyDown(GLFW_KEY_A)) position = position.add(getLookVector().cross(new Vec3(0, 1, 0)));
   if (isKeyDown(GLFW_KEY_D))
     position = position.add(getLookVector().cross(new Vec3(0, 1, 0).negate()));
   if (isKeyDown(GLFW_KEY_LEFT_SHIFT)) position.y += speed;
   if (isKeyDown(GLFW_KEY_SPACE)) position.y -= speed;
 }
Esempio n. 2
0
 private Vec3 getLookVector() {
   Vec3 vec =
       Vec3.fromAngles((float) Math.toRadians(pitch), (float) Math.toRadians(yaw)).scale(speed);
   return vec;
 }