summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Test/RootConstainTest.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-13 10:33:05 +0800
committerchai <chaifix@163.com>2020-10-13 10:33:05 +0800
commitfc6de82e75310b4c007d80753a5f58e6692f4855 (patch)
treee6d8d9226595a6727d43f18a218f53533101a4e0 /Assets/Scripts/Test/RootConstainTest.cs
parent8cd16fb71177bb61a9475284d944bc6aba30740e (diff)
+misc
Diffstat (limited to 'Assets/Scripts/Test/RootConstainTest.cs')
-rw-r--r--Assets/Scripts/Test/RootConstainTest.cs70
1 files changed, 35 insertions, 35 deletions
diff --git a/Assets/Scripts/Test/RootConstainTest.cs b/Assets/Scripts/Test/RootConstainTest.cs
index 43c22b67..3de174ee 100644
--- a/Assets/Scripts/Test/RootConstainTest.cs
+++ b/Assets/Scripts/Test/RootConstainTest.cs
@@ -1,35 +1,35 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class RootConstainTest : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-
- private void OnAnimatorMove()
- {
- Animator animator = GetComponent<Animator>();
-
- // 约束z=0
- if (animator)
- {
- //animator.ApplyBuiltinRootMotion();
- transform.position += new Vector3(animator.deltaPosition.x, animator.deltaPosition.y, 0);
- transform.forward = animator.deltaRotation * transform.forward;
- Vector3 euler = animator.deltaRotation.ToEuler();
- euler.x = euler.z = euler.y = 0;
- transform.rotation *= Quaternion.Euler(euler);
- }
- }
-
-}
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class RootConstainTest : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+
+ private void OnAnimatorMove()
+ {
+ Animator animator = GetComponent<Animator>();
+
+ // 约束z=0
+ if (animator)
+ {
+ //animator.ApplyBuiltinRootMotion();
+ transform.position += new Vector3(animator.deltaPosition.x, animator.deltaPosition.y, 0);
+ transform.forward = animator.deltaRotation * transform.forward;
+ Vector3 euler = animator.deltaRotation.ToEuler();
+ euler.x = euler.z = euler.y = 0;
+ transform.rotation *= Quaternion.Euler(euler);
+ }
+ }
+
+}