mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-14 07:35:10 +01:00
Clamp the speed to 1 so using dpad will not double the speed
This commit is contained in:
@@ -64,6 +64,7 @@ public final class MovementHandler implements PressAction {
|
|||||||
|
|
||||||
// Do a implicit square here
|
// Do a implicit square here
|
||||||
movementR = this.slowdownFactor * (Math.pow(this.movementSideways, 2) + Math.pow(this.movementForward, 2));
|
movementR = this.slowdownFactor * (Math.pow(this.movementSideways, 2) + Math.pow(this.movementForward, 2));
|
||||||
|
movementR = MathHelper.clamp(movementR, 0.f, 1.f);
|
||||||
movementTheta = Math.atan2(this.movementForward, this.movementSideways);
|
movementTheta = Math.atan2(this.movementForward, this.movementSideways);
|
||||||
player.input.movementForward = (float) (movementR * Math.sin(movementTheta));
|
player.input.movementForward = (float) (movementR * Math.sin(movementTheta));
|
||||||
player.input.movementSideways = (float) (movementR * Math.cos(movementTheta));
|
player.input.movementSideways = (float) (movementR * Math.cos(movementTheta));
|
||||||
|
|||||||
Reference in New Issue
Block a user