From 2ac3ab0c6a315e678d21aa6bd4a0a660a2c46acf Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 18 Feb 2022 15:15:07 +0800 Subject: *misc --- .../FPSControllerVelocity/Scripts/FPSCharacterController.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts') diff --git a/JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/FPSCharacterController.cs b/JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/FPSCharacterController.cs index a6d844f..3884a26 100644 --- a/JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/FPSCharacterController.cs +++ b/JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/FPSCharacterController.cs @@ -155,7 +155,7 @@ namespace JamTools Vector3 right = transform.right; Vector3 forward = transform.forward; - m_MoveDirection = right * moveX + forward * moveZ; + Vector3 dir = right * moveX + forward * moveZ; if (IsModuleActive(CharacterModule.WalkOnSlope)) { @@ -165,17 +165,18 @@ namespace JamTools if (Physics.Raycast(m_GroundChecker.foot.position, Vector3.down, out hitInfo)) { Vector3 normal = hitInfo.normal; - m_MoveDirection = Vector3.ProjectOnPlane(m_MoveDirection, normal); + dir = Vector3.ProjectOnPlane(dir, normal); GizmosHandle.Instance.DoGizmos(() => { - Gizmos.DrawLine(hitInfo.point + new Vector3(0, 0.1f, 0), hitInfo.point + m_MoveDirection); + Gizmos.DrawLine(hitInfo.point + new Vector3(0, 0.1f, 0), hitInfo.point + dir); }); } } } - m_MoveDirection = m_MoveDirection.normalized; + dir = dir.normalized; + m_MoveDirection = Vector3.Slerp(m_MoveDirection, dir, 1f); } void MoveAroundFixedUpdate() @@ -370,6 +371,7 @@ namespace JamTools private void Update() { + LookAround(); MoveAroundUpdate(); MoveInAirUpdate(); Jump(); @@ -383,7 +385,6 @@ namespace JamTools private void FixedUpdate() { - LookAround(); MoveAroundFixedUpdate(); MoveInAirFixedUpdate(); DodgeFixed(); -- cgit v1.1-26-g67d0