From d644c5fd05b082b5a56d233e670689553242fa2c Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 28 Sep 2024 19:09:35 +0200 Subject: reliable fps movement --- client/player/controllable_player.gd | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd index c88941d7..131bc55d 100644 --- a/client/player/controllable_player.gd +++ b/client/player/controllable_player.gd @@ -60,13 +60,20 @@ func _process(delta): update_touch_scrolls() var moving_duration = 0 +var fps_rotation_target = 0 func _process_movement(delta): var input = Input.get_vector("left", "right", "forwards", "backwards") if is_input_enabled() else Vector2.ZERO if Global.get_setting("gameplay.first_person"): - input.x *= 0.1 + fps_rotation_target += input.x * delta * 3. + if abs(input.x) > 0.1: input.y -= 0.5 + input.x = 0. input.y = min(input.y, 0) + input = input.rotated(fps_rotation_target) + else: + input = input.rotated(input_rotation) + var boost = Input.is_action_pressed("boost") or (Global.get_setting("gameplay.latch_boost") and boosting) - input = input.rotated(input_rotation) + # if Input.is_action_pressed("interact") or Input.is_action_just_released("interact"): input *= 0 else: -- cgit v1.2.3-70-g09d2