using System.Collections; using System.Collections.Generic; using UnityEngine; public class PoseLookAt : MonoBehaviour { public Transform _neck; public Transform _lookAt; private Animator _CharacterAnimator; [HideInInspector] public Quaternion _neckGameRot; private static PoseLookAt _instance; public static PoseLookAt GetInstance() { return _instance; } public void Awake() { if (!_instance) { _instance = this; } } // Start is called before the first frame update void Start() { //_CharacterAnimator = GetComponent(); //_neck = _CharacterAnimator.GetBoneTransform(HumanBodyBones.Neck); _lookAt = GameObject.Find("PhotomodeLookAt").transform; ValuesUpdate(); } public void ValuesUpdate() { _CharacterAnimator = PoseManager.Getinstance().currentCharacterAnimator; _neck = _CharacterAnimator.GetBoneTransform(HumanBodyBones.Neck); } private void OnAnimatorIK() { if (PhotomodeManager.GetInstance().photoModeOpen) //If photomode is open: { Quaternion neckRotation = _neck.rotation = Quaternion.LookRotation(_lookAt.forward, _lookAt.up); _CharacterAnimator.SetBoneLocalRotation(HumanBodyBones.Neck, neckRotation); } } }