From 162bab6592dc4f33e1719c0d9b1a700990aeb295 Mon Sep 17 00:00:00 2001 From: Alejandro Villalba Date: Mon, 30 Sep 2024 12:45:41 +0200 Subject: [PATCH] fix: Avatar moving on its own when pressin CAPS (#1743) The feature has been removed from code and from the input system config. --- .../Components/MovementInputComponent.cs | 1 - .../Systems/UpdateInputMovementSystem.cs | 14 --------- .../DCL/Input/UnityInputSystem/DCLInput.cs | 30 ------------------- .../UnityInputSystem/DCLInput.inputactions | 20 ------------- 4 files changed, 65 deletions(-) diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Components/MovementInputComponent.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Components/MovementInputComponent.cs index 691b75bd03..477b096863 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Components/MovementInputComponent.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Components/MovementInputComponent.cs @@ -5,7 +5,6 @@ namespace DCL.CharacterMotion.Components { public struct MovementInputComponent : IInputComponent { - public bool AutoWalk; public MovementKind Kind; /// diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputMovementSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputMovementSystem.cs index b198b81cc1..69c476d1b5 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputMovementSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputMovementSystem.cs @@ -17,14 +17,12 @@ public partial class UpdateInputMovementSystem : UpdateInputSystem(); - if (!inputModifierComponent.DisableWalk && autoWalkAction.WasPerformedThisFrame()) - inputToUpdate.AutoWalk = !inputToUpdate.AutoWalk; - - if (inputToUpdate is { AutoWalk: true, Axes: { sqrMagnitude: > 0.1f } }) - inputToUpdate.AutoWalk = false; - if (inputToUpdate.Axes == Vector2.zero) inputToUpdate.Kind = MovementKind.IDLE; else @@ -58,12 +50,6 @@ private void UpdateInput(ref MovementInputComponent inputToUpdate, in InputModif inputToUpdate.Kind = ProcessInputMovementKind(inputModifierComponent, runPressed, walkPressed); } - - if (inputToUpdate.AutoWalk) - { - inputToUpdate.Axes = new Vector2(0, 1); - inputToUpdate.Kind = MovementKind.WALK; - } } private static MovementKind ProcessInputMovementKind(InputModifierComponent inputModifierComponent, bool runPressed, bool walkPressed) diff --git a/Explorer/Assets/DCL/Input/UnityInputSystem/DCLInput.cs b/Explorer/Assets/DCL/Input/UnityInputSystem/DCLInput.cs index 54370fffc6..d77c055d27 100644 --- a/Explorer/Assets/DCL/Input/UnityInputSystem/DCLInput.cs +++ b/Explorer/Assets/DCL/Input/UnityInputSystem/DCLInput.cs @@ -161,15 +161,6 @@ public @DCLInput() ""processors"": """", ""interactions"": """", ""initialStateCheck"": false - }, - { - ""name"": ""AutoWalk"", - ""type"": ""Button"", - ""id"": ""b4656ae5-6783-44e3-aab6-f47c82bbb0b5"", - ""expectedControlType"": ""Button"", - ""processors"": """", - ""interactions"": """", - ""initialStateCheck"": false } ], ""bindings"": [ @@ -601,17 +592,6 @@ public @DCLInput() ""action"": ""Walk"", ""isComposite"": false, ""isPartOfComposite"": false - }, - { - ""name"": """", - ""id"": ""ce03bf46-b4a6-4780-b639-6cf34b8a35cc"", - ""path"": ""/capsLock"", - ""interactions"": """", - ""processors"": """", - ""groups"": """", - ""action"": ""AutoWalk"", - ""isComposite"": false, - ""isPartOfComposite"": false } ] }, @@ -2919,7 +2899,6 @@ public @DCLInput() m_Player_ActionBackward = m_Player.FindAction("ActionBackward", throwIfNotFound: true); m_Player_ActionRight = m_Player.FindAction("ActionRight", throwIfNotFound: true); m_Player_ActionLeft = m_Player.FindAction("ActionLeft", throwIfNotFound: true); - m_Player_AutoWalk = m_Player.FindAction("AutoWalk", throwIfNotFound: true); // Camera m_Camera = asset.FindActionMap("Camera", throwIfNotFound: true); m_Camera_ZoomOut = m_Camera.FindAction("ZoomOut", throwIfNotFound: true); @@ -3070,7 +3049,6 @@ public int FindBinding(InputBinding bindingMask, out InputAction action) private readonly InputAction m_Player_ActionBackward; private readonly InputAction m_Player_ActionRight; private readonly InputAction m_Player_ActionLeft; - private readonly InputAction m_Player_AutoWalk; public struct PlayerActions { private @DCLInput m_Wrapper; @@ -3090,7 +3068,6 @@ public struct PlayerActions public InputAction @ActionBackward => m_Wrapper.m_Player_ActionBackward; public InputAction @ActionRight => m_Wrapper.m_Player_ActionRight; public InputAction @ActionLeft => m_Wrapper.m_Player_ActionLeft; - public InputAction @AutoWalk => m_Wrapper.m_Player_AutoWalk; public InputActionMap Get() { return m_Wrapper.m_Player; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } @@ -3145,9 +3122,6 @@ public void AddCallbacks(IPlayerActions instance) @ActionLeft.started += instance.OnActionLeft; @ActionLeft.performed += instance.OnActionLeft; @ActionLeft.canceled += instance.OnActionLeft; - @AutoWalk.started += instance.OnAutoWalk; - @AutoWalk.performed += instance.OnAutoWalk; - @AutoWalk.canceled += instance.OnAutoWalk; } private void UnregisterCallbacks(IPlayerActions instance) @@ -3197,9 +3171,6 @@ private void UnregisterCallbacks(IPlayerActions instance) @ActionLeft.started -= instance.OnActionLeft; @ActionLeft.performed -= instance.OnActionLeft; @ActionLeft.canceled -= instance.OnActionLeft; - @AutoWalk.started -= instance.OnAutoWalk; - @AutoWalk.performed -= instance.OnAutoWalk; - @AutoWalk.canceled -= instance.OnAutoWalk; } public void RemoveCallbacks(IPlayerActions instance) @@ -3967,7 +3938,6 @@ public interface IPlayerActions void OnActionBackward(InputAction.CallbackContext context); void OnActionRight(InputAction.CallbackContext context); void OnActionLeft(InputAction.CallbackContext context); - void OnAutoWalk(InputAction.CallbackContext context); } public interface ICameraActions { diff --git a/Explorer/Assets/DCL/Input/UnityInputSystem/DCLInput.inputactions b/Explorer/Assets/DCL/Input/UnityInputSystem/DCLInput.inputactions index aabfe32b15..efe537511f 100644 --- a/Explorer/Assets/DCL/Input/UnityInputSystem/DCLInput.inputactions +++ b/Explorer/Assets/DCL/Input/UnityInputSystem/DCLInput.inputactions @@ -139,15 +139,6 @@ "processors": "", "interactions": "", "initialStateCheck": false - }, - { - "name": "AutoWalk", - "type": "Button", - "id": "b4656ae5-6783-44e3-aab6-f47c82bbb0b5", - "expectedControlType": "Button", - "processors": "", - "interactions": "", - "initialStateCheck": false } ], "bindings": [ @@ -579,17 +570,6 @@ "action": "Walk", "isComposite": false, "isPartOfComposite": false - }, - { - "name": "", - "id": "ce03bf46-b4a6-4780-b639-6cf34b8a35cc", - "path": "/capsLock", - "interactions": "", - "processors": "", - "groups": "", - "action": "AutoWalk", - "isComposite": false, - "isPartOfComposite": false } ] },