From 46eec303e021b2554c68046583b7fe5e7adff637 Mon Sep 17 00:00:00 2001 From: Pasha Bibko Date: Fri, 28 Mar 2025 12:12:55 +0000 Subject: [PATCH] Tidied up a bit of code --- Assets/Scripts/Player/PlayerMovement.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 710dffb..be405fb 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -194,14 +194,14 @@ public class PlayerMovement : MonoBehaviour Vector3 foward = Vector3.Cross(normal, transform.up); // Flips the foward direction if facing the other direction - if ((m_Orientation.forward - foward).magnitude > (m_Orientation.forward - -foward).magnitude) + if ((m_Orientation.forward - foward).magnitude > (m_Orientation.forward - (-foward)).magnitude) { foward = -foward; } // Applies the wall running force to the player m_Body.AddForce(foward * m_WallRunSpeed * m_Body.mass * 10.0f, ForceMode.Force); // Removes any vertical velocity the player may have - //m_Body.velocity = new Vector3(m_Body.velocity.x, 0.0f, m_Body.velocity.z); + m_Body.velocity = new Vector3(m_Body.velocity.x, 0.0f, m_Body.velocity.z); } // Function to make the player jump @@ -224,11 +224,7 @@ public class PlayerMovement : MonoBehaviour // Works out wether the player's velocity is high enough to slide Vector3 vel = m_Body.velocity; - bool canSlide = - !( - Mathf.Abs(vel.x) < m_SlideRequiredSpeed && - Mathf.Abs(vel.z) < m_SlideRequiredSpeed - ); + bool canSlide = !(Mathf.Abs(vel.x) < m_SlideRequiredSpeed && Mathf.Abs(vel.z) < m_SlideRequiredSpeed); // Checks if the player is in the wall running state if (m_HitLhsWall || m_HitRhsWall)