Created
May 11, 2017 12:58
-
-
Save onotchi/5d2fe245c6ff5b190a56bcfe31141141 to your computer and use it in GitHub Desktop.
IK Passの間で目の回転を制御する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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