From a10a5c56bf0db8e2b95b4300011fb86b5e95161a Mon Sep 17 00:00:00 2001 From: David Briscoe Date: Sun, 15 Oct 2023 00:20:23 -0700 Subject: [PATCH] Use circular movement deadzone get_vector is a circular deadzone, but two get_axis will be a cross-shaped one. https://docs.godotengine.org/en/stable/tutorials/inputs/controllers_gamepads_joysticks.html#which-input-singleton-method-should-i-use https://github.com/godotengine/godot-docs/issues/5378#issuecomment-1635899278 --- objects/player.gd | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/objects/player.gd b/objects/player.gd index 12f58f0..fa9e510 100644 --- a/objects/player.gd +++ b/objects/player.gd @@ -18,7 +18,6 @@ var mouse_captured := true var movement_velocity: Vector3 var rotation_delta: Vector2 # x: horizontal, y: vertical -var input: Vector3 var input_mouse: Vector2 var health: int = 100 @@ -157,10 +156,8 @@ func handle_controls(_delta): # Movement - input.x = Input.get_axis("move_left", "move_right") - input.z = Input.get_axis("move_forward", "move_back") - - movement_velocity = input.normalized() * movement_speed + var input := Input.get_vector("move_left", "move_right", "move_forward", "move_back") + movement_velocity = Vector3(input.x, 0, input.y).normalized() * movement_speed # Rotation