diff options
Diffstat (limited to 'JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts')
-rw-r--r-- | JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/FPSCharacterController.cs | 11 |
1 files changed, 6 insertions, 5 deletions
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();
|