blob: fdc5c2a3dc85a8004179b6de2d2dec91b73521ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);
}
}
|