summaryrefslogtreecommitdiff
path: root/_ActiveRagdoll/MovementDataHandler.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-03-15 21:03:07 +0800
committerchai <215380520@qq.com>2024-03-15 21:03:07 +0800
commit78304183fb59e243a2d6da4a00a4311ae21c9717 (patch)
treeaeae48561b9a5c25a1d58de28b8b3e2af37598e4 /_ActiveRagdoll/MovementDataHandler.cs
parentdbba1ae118a70db8be668806c0af8655e7b4afe7 (diff)
*misc
Diffstat (limited to '_ActiveRagdoll/MovementDataHandler.cs')
-rw-r--r--_ActiveRagdoll/MovementDataHandler.cs92
1 files changed, 0 insertions, 92 deletions
diff --git a/_ActiveRagdoll/MovementDataHandler.cs b/_ActiveRagdoll/MovementDataHandler.cs
deleted file mode 100644
index 18d43f5..0000000
--- a/_ActiveRagdoll/MovementDataHandler.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using UnityEngine;
-
-public class MovementDataHandler : MonoBehaviour
-{
- [HideInInspector]
- public Vector3 groundedForward;
-
- [HideInInspector]
- public Vector3 right;
-
- [HideInInspector]
- public Vector3 left;
-
- [HideInInspector]
- public Vector3 groundedBack;
-
- private Transform hip;
-
- private Transform torso;
-
- public Transform rotationTarget;
-
- [HideInInspector]
- public float slopeStrenght;
-
- public float slopeVelocityStrenght;
-
- [HideInInspector]
- public float sinceJump = 1f;
-
- [HideInInspector]
- public Vector3 groundNormal;
-
- private InputHandler inputHandler;
-
- private Transform leftKnee;
-
- private Transform rightKnee;
-
- private void Start()
- {
- inputHandler = GetComponent<InputHandler>();
- hip = GetComponentInChildren<Hip>().transform;
- torso = GetComponentInChildren<Torso>().transform;
- if (!rotationTarget)
- {
- rotationTarget = GetComponentInChildren<RotationTarget>().transform;
- }
- KneeLeft componentInChildren = GetComponentInChildren<KneeLeft>();
- if ((bool)componentInChildren)
- {
- leftKnee = componentInChildren.transform;
- }
- KneeRight componentInChildren2 = GetComponentInChildren<KneeRight>();
- if ((bool)componentInChildren2)
- {
- rightKnee = componentInChildren2.transform;
- }
- }
-
- private void Update()
- {
- sinceJump += Time.deltaTime;
- groundedForward = rotationTarget.forward;
- groundedForward.y = slopeStrenght * 1f;
- groundedForward = groundedForward.normalized;
- groundedBack = -groundedForward;
- right = rotationTarget.right;
- left = -rotationTarget.right;
- slopeStrenght = Mathf.Lerp(slopeStrenght, 0f, Time.deltaTime * 1f);
- Debug.DrawLine(hip.position, hip.position + groundedForward * 10f);
- }
-
- public void SetSlope(Vector3 normal)
- {
- groundNormal = normal;
- slopeStrenght = Vector3.Cross(rotationTarget.right, normal).y;
- Vector3 lhs = Vector3.Cross(Vector3.up, inputHandler.inputMovementDirection);
- slopeVelocityStrenght = Vector3.Cross(lhs, normal).y;
- }
-
- public float GetSmallestLegAngle()
- {
- float num = Vector3.Angle(leftKnee.forward, Vector3.down);
- float num2 = Vector3.Angle(rightKnee.forward, Vector3.down);
- if (num < num2)
- {
- return num;
- }
- return num2;
- }
-}