using System.Collections; using System.Collections.Generic; using UnityEngine; namespace UDE_HAND_INTERACTION { public class DollHand : MonoBehaviour { [SerializeField] private List _jointSets = new List(FingersData.HAND_JOINT_IDS.Length); public List JointSets { get { return _jointSets; } } private JointCollection _jointsCache; private JointCollection JointsCache { get { if (_jointsCache == null) { _jointsCache = new JointCollection(_jointSets); } return _jointsCache; } } public void SetJointRotations(in Quaternion[] jointRotations) { for (int i = 0; i < FingersData.HAND_JOINT_IDS.Length; ++i) { HandJointsSet jointSet = JointsCache[i]; if (jointSet != null) { Transform jointTransform = jointSet.transform; Quaternion targetRot = jointSet.RotationOffset * jointRotations[i]; jointTransform.localRotation = targetRot; } } } public void SetRootPose(in Pose rootPose) { this.transform.SetPose(rootPose, Space.World); } } }