21 lines
613 B
C#
21 lines
613 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
namespace BITKit
|
|
{
|
|
public class AnimatorLookAt : MonoBehaviour
|
|
{
|
|
public Animator animator;
|
|
public float weight;
|
|
public float headWeight;
|
|
public float bodyWeight;
|
|
public float eyesWeight;
|
|
public Transform target;
|
|
public Vector3 offset;
|
|
void OnAnimatorIK(int layerIndex)
|
|
{
|
|
animator.SetLookAtWeight(weight, headWeight, bodyWeight, eyesWeight);
|
|
animator.SetLookAtPosition(target.rotation * offset + target.position);
|
|
}
|
|
}
|
|
} |