From 19f8662bad5c77db5cf0e4190899e3eedd069e70 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 4 Oct 2025 15:39:10 -0400 Subject: [PATCH] fix: modifications to direction handling for when move stick is pressed lightly --- Assets/Scripts/Units/UnitMovementHandler.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Units/UnitMovementHandler.cs b/Assets/Scripts/Units/UnitMovementHandler.cs index 246fa0e..280b04f 100644 --- a/Assets/Scripts/Units/UnitMovementHandler.cs +++ b/Assets/Scripts/Units/UnitMovementHandler.cs @@ -64,8 +64,8 @@ namespace Reset.Units{ targetDirection = (Camera.main.transform.rotation * targetDirection.ToVector3()).ToVector2(); // Deadzone - if (targetDirection.magnitude < .08f) { - targetDirection = Vector2.zero; + if (targetDirection.magnitude < .1f) { + targetDirection = resolvedMovement.moveDirection.RawWorld; } // Set Raw Direction (this is used by the camera later) @@ -94,7 +94,9 @@ namespace Reset.Units{ newDirection = Vector2.Lerp(slerpedValue, lerpedValue, directionChangeDotLerp); } else { newDirection = Vector2.SmoothDamp(currentDirection, targetDirection, ref refVelocityDirectionChangingHardness, data.directionChangingSoftness.Value * data.airDirectionDecay.Value * Time.deltaTime); - } + } + + newDirection = Vector3.Slerp(resolvedMovement.moveDirection.World, newDirection, controls.rawMoveInput.magnitude); // Commit the new direction resolvedMovement.moveDirection.World = newDirection;