summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Test/IKTest.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-13 07:02:26 +0800
committerchai <chaifix@163.com>2020-10-13 07:02:26 +0800
commit58a47386a711746d17c5c66ac897a53f7a4aad4b (patch)
treee73d4906280793b5fb3070fe258333e0ad988115 /Assets/Scripts/Test/IKTest.cs
parent8b384dffa0d9c63c7a657c6e567c2ddefbf046cd (diff)
+samurai & ninja animations
Diffstat (limited to 'Assets/Scripts/Test/IKTest.cs')
-rw-r--r--Assets/Scripts/Test/IKTest.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Assets/Scripts/Test/IKTest.cs b/Assets/Scripts/Test/IKTest.cs
new file mode 100644
index 00000000..4e203be9
--- /dev/null
+++ b/Assets/Scripts/Test/IKTest.cs
@@ -0,0 +1,33 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class IKTest : MonoBehaviour
+{
+ public GameObject Go_FootIK;
+ [Range(0,1)]
+ public float IKWeight;
+
+ private Animator animator;
+
+ private void Start()
+ {
+
+ }
+
+ private void OnAnimatorIK(int layerIndex)
+ {
+ if(animator == null)
+ {
+ animator = GetComponent<Animator>();
+ }
+
+ animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, IKWeight);
+ animator.SetIKPosition(AvatarIKGoal.LeftFoot, Go_FootIK.transform.position);
+
+ animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, IKWeight);
+ animator.SetIKRotation(AvatarIKGoal.LeftFoot, Go_FootIK.transform.rotation);
+
+ }
+
+}