Compare commits
6 Commits
ccb7cd90d0
...
renovate/o
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b66a66b15 | |||
| caa59cd72f | |||
| a31c018b92 | |||
| 008bbff99c | |||
| 6f28e01e5c | |||
| c7313a0487 |
@@ -17,12 +17,22 @@ public class FpsCameraController {
|
||||
private float yaw = 0f;
|
||||
private float pitch = 0f;
|
||||
|
||||
private float eyeHeight = 1.8f;
|
||||
private final float eyeHeight = 1.8f;
|
||||
private final float jumpSpeed = 12f;
|
||||
private final float gravity = -50f;
|
||||
private float velocityY = 0f;
|
||||
private float gravity = -50f;
|
||||
private float jumpSpeed = 12f;
|
||||
private boolean grounded = false;
|
||||
|
||||
// --- approximation toggles
|
||||
private final boolean retroQuantization = true;
|
||||
|
||||
// how coarse the rotation is (0.25f = round to 0.25°)
|
||||
private final float yawStepDegrees = 0.2f;
|
||||
private final float pitchStepDegrees = 0.2f;
|
||||
|
||||
// how coarse the position is (16f = steps of 1/16 units)
|
||||
private final float positionQuantize = 64f;
|
||||
|
||||
private final Vector3 tmpForward = new Vector3();
|
||||
private final Vector3 tmpRight = new Vector3();
|
||||
|
||||
@@ -205,12 +215,29 @@ public class FpsCameraController {
|
||||
velocityY = jumpSpeed;
|
||||
grounded = false;
|
||||
}
|
||||
|
||||
// snap position to quantization steps
|
||||
if (retroQuantization) {
|
||||
float q = positionQuantize;
|
||||
camera.position.x = Math.round(camera.position.x * q) / q;
|
||||
camera.position.y = Math.round(camera.position.y * q) / q;
|
||||
camera.position.z = Math.round(camera.position.z * q) / q;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCameraDirection() {
|
||||
// build direction vector from yaw/pitch
|
||||
float yawRad = (float) Math.toRadians(yaw);
|
||||
float pitchRad = (float) Math.toRadians(pitch);
|
||||
float useYaw = yaw;
|
||||
float usePitch = pitch;
|
||||
|
||||
if (retroQuantization) {
|
||||
// snap yaw/pitch to fixed angular steps
|
||||
useYaw = Math.round(useYaw / yawStepDegrees) * yawStepDegrees;
|
||||
usePitch = Math.round(usePitch / pitchStepDegrees) * pitchStepDegrees;
|
||||
}
|
||||
|
||||
float yawRad = (float) Math.toRadians(useYaw);
|
||||
float pitchRad = (float) Math.toRadians(usePitch);
|
||||
|
||||
float x = (float) (Math.cos(pitchRad) * Math.sin(yawRad));
|
||||
float y = (float) Math.sin(pitchRad);
|
||||
|
||||
@@ -6,7 +6,7 @@ buildscript {
|
||||
dependencies {
|
||||
classpath "io.github.fourlastor:construo:2.1.0"
|
||||
if(enableGraalNative == 'true') {
|
||||
classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.28"
|
||||
classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.11.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
// Applies the foojay-resolver plugin to allow automatic download of JDKs.
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
}
|
||||
// A list of which subprojects to load as part of the same larger project.
|
||||
// You can remove Strings from the list and reload the Gradle project
|
||||
|
||||
Reference in New Issue
Block a user