added a max velocity for player and fixed the multiple back inputs in menus

This commit is contained in:
2026-02-06 15:12:36 +01:00
parent 6d967bf2bf
commit 4c1831762b
4 changed files with 15 additions and 13 deletions

View File

@@ -98,6 +98,9 @@ public partial class PlayerController : CharacterBody3D,
// Movement stuff
[ExportCategory("Movement")]
[ExportGroup("General")]
[Export(PropertyHint.Range, "10,200,0.1,or_greater")]
public float AbsoluteMaxSpeed { get; set; } = 100f;
[ExportGroup("Ground")]
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
public float WalkSpeed { get; set; } = 7.0f;
@@ -1985,6 +1988,10 @@ public partial class PlayerController : CharacterBody3D,
if (_currentInputBufferFrames > 0) _currentInputBufferFrames -= 1;
// Limit maximum speed
if (Velocity.Length() > AbsoluteMaxSpeed)
Velocity = Velocity.Normalized() * AbsoluteMaxSpeed;
// Manage head and camera movement
LookAround(delta);