summaryrefslogtreecommitdiff
path: root/Assets/Scripts/IKTest.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-11 20:00:58 +0800
committerchai <chaifix@163.com>2020-10-11 20:00:58 +0800
commit8b384dffa0d9c63c7a657c6e567c2ddefbf046cd (patch)
tree3f4d669b73b6622aa49627c4ccb3c78d51a82bde /Assets/Scripts/IKTest.cs
parentcd3aee8d640f6abcc82802ca7abbcdfa031c20d3 (diff)
+Saionji show off scene
Diffstat (limited to 'Assets/Scripts/IKTest.cs')
-rw-r--r--Assets/Scripts/IKTest.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Assets/Scripts/IKTest.cs b/Assets/Scripts/IKTest.cs
new file mode 100644
index 00000000..600fe274
--- /dev/null
+++ b/Assets/Scripts/IKTest.cs
@@ -0,0 +1,27 @@
+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 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);
+ }
+
+}