You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.4 KiB
54 lines
1.4 KiB
|
1 month ago
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace UDE_HAND_INTERACTION
|
||
|
|
{
|
||
|
|
public class DollHand : MonoBehaviour
|
||
|
|
{
|
||
|
|
[SerializeField]
|
||
|
|
private List<HandJointsSet> _jointSets = new List<HandJointsSet>(FingersData.HAND_JOINT_IDS.Length);
|
||
|
|
|
||
|
|
public List<HandJointsSet> 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);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|