Skip to content

Instantly share code, notes, and snippets.

@onotchi
Created May 11, 2017 12:58
Show Gist options
  • Save onotchi/5d2fe245c6ff5b190a56bcfe31141141 to your computer and use it in GitHub Desktop.
Save onotchi/5d2fe245c6ff5b190a56bcfe31141141 to your computer and use it in GitHub Desktop.
IK Passの間で目の回転を制御する
using UnityEngine;
public class EyeRotator : MonoBehaviour
{
public Vector3 RotationL;
public Vector3 RotationR;
private Animator _animator;
// Use this for initialization
private void Start()
{
this._animator = this.GetComponent<Animator>();
}
// Update is called once per frame
private void Update()
{
}
private void OnAnimatorIK(int layerIndex)
{
this._animator.SetBoneLocalRotation(HumanBodyBones.LeftEye, Quaternion.Euler(this.RotationL));
this._animator.SetBoneLocalRotation(HumanBodyBones.RightEye, Quaternion.Euler(this.RotationR));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment