aboutsummaryrefslogtreecommitdiff
path: root/JamHelper/Assets/JamUtils/FPSControllerVelocity
diff options
context:
space:
mode:
Diffstat (limited to 'JamHelper/Assets/JamUtils/FPSControllerVelocity')
-rw-r--r--JamHelper/Assets/JamUtils/FPSControllerVelocity/Demo/Scenes/FPSCharacterController.unity1
-rw-r--r--JamHelper/Assets/JamUtils/FPSControllerVelocity/README~1
-rw-r--r--JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/FPSCharacterController.cs11
3 files changed, 8 insertions, 5 deletions
diff --git a/JamHelper/Assets/JamUtils/FPSControllerVelocity/Demo/Scenes/FPSCharacterController.unity b/JamHelper/Assets/JamUtils/FPSControllerVelocity/Demo/Scenes/FPSCharacterController.unity
index 139d3fa..c8da4c6 100644
--- a/JamHelper/Assets/JamUtils/FPSControllerVelocity/Demo/Scenes/FPSCharacterController.unity
+++ b/JamHelper/Assets/JamUtils/FPSControllerVelocity/Demo/Scenes/FPSCharacterController.unity
@@ -924,6 +924,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 60e373202cc879c4a8e781f92dbdcb48, type: 3}
m_Name:
m_EditorClassIdentifier:
+ type: 5
--- !u!114 &148244783
MonoBehaviour:
m_ObjectHideFlags: 0
diff --git a/JamHelper/Assets/JamUtils/FPSControllerVelocity/README~ b/JamHelper/Assets/JamUtils/FPSControllerVelocity/README~
new file mode 100644
index 0000000..c240298
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/FPSControllerVelocity/README~
@@ -0,0 +1 @@
+用rigidbody.velocity移动角色 \ No newline at end of file
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();