From 8b384dffa0d9c63c7a657c6e567c2ddefbf046cd Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 11 Oct 2020 20:00:58 +0800 Subject: +Saionji show off scene --- Assets/Scripts/IKTest.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Assets/Scripts/IKTest.cs (limited to 'Assets/Scripts/IKTest.cs') 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.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); + } + +} -- cgit v1.1-26-g67d0