Skip to main content

MasterHand

A class in Root.Township, Alta.Character.

Copies the finger bone rotations of the hand-pose (master) hand onto the character rig's IK hand after the grip updates each frame.

Constructors​

MemberWhat it is
MasterHand()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private CharacterDummyPointer dummyPointer to the character dummy whose rig holds the IK hand.
private static int[] fingerChildIndexChild index of each finger under the IK hand root.
private HandGrip handGripThe hand grip whose PostLateUpdate drives the copy.
private BoneIdentifier ikHandRootBone identifier for the IK hand root on the rig.
private Transform ikHandRootTransformBacking field for IKHandRoot, resolved in Awake.
private Transform[] masterHandBonesMaster finger bones to copy from.
private Transform masterHandRootBacking field for MasterHandRoot.
private Dictionary<Transform, Transform> masterToIKMapMaster bone to IK bone lookup built by SetupBonesMap.

Properties​

MemberWhat it is
Transform IKHandRoot { get; }The rig's IK hand root that rotations are copied to.
Transform MasterHandRoot { get; }Root of the master hand whose finger bones are the source.

Methods​

MemberWhat it is
static Transform[] GetFingerBonesFromRoot(Transform root)Returns a hand root's five finger bones in the game's finger order.
8 private and internal methods
MemberWhat it is
private bool ApplyBones()Editor apply method: fills or clears masterHandBones depending on whether an IK hand root bone is set.
private void Awake()Finds the IK hand root on the character rig and builds the bone map.
private void CopyHandBones()Copies local rotations from each master finger bone to its IK counterpart. Hooked to the grip's PostLateUpdate.
private void CopyHandBones(Dictionary<Transform, Transform> bonesMap)Copies local rotations from each master finger bone to its IK counterpart. Hooked to the grip's PostLateUpdate.
private void OnDisable()Stops copying bones.
private void OnDrawGizmos()Draws a red line from the master hand root to the IK hand root.
private void OnEnable()Starts copying bones after each grip late update, if an IK root is set.
private void SetupBonesMap()Maps each master finger joint (three per finger) to the matching IK hand joint.

Used in​

Members of other types that take, return or hold a MasterHand: