๐ซณHand Animator
Hand Animator
The HandAnimator class is responsible for managing the animation and pose transitions of a hand in Unity. It uses the HandPoseData struct to represent various hand poses and smoothly transitions between them based on user inputs or interactions with HandPoseArea components.

Public Variables
Default Pose Transition Time: The default time it takes to transition between poses.Default Pose Transition Curve: The default animation curve used for transitioning between poses.Current Pose Area: The currentHandPoseAreathe hand is interacting with.
Properties
Hand Pose Data Non Alloc: Returns a reference to the non-allocatedHandPoseDataused for temporary calculations.Open Hand Pose: Returns a reference to theHandPoseDatarepresenting the open hand pose.Close Hand Pose: Returns a reference to theHandPoseDatarepresenting the closed hand pose.Current Input Pose: Returns a reference to theHandPoseDatarepresenting the current input pose.Current Target Pose: Returns a reference to theHandPoseDatarepresenting the target pose the hand is transitioning to.Current Hand Pose: Returns a reference to theHandPoseDatarepresenting the current hand pose.Current Hand Smooth Pose: Returns a reference to theHandPoseDatarepresenting the smoothly interpolated hand pose.
Public Methods
SetTargetPose()
Sets the target pose for the hand to transition to over a specified duration with a specified animation curve.
Parameters:
poseData: The target pose data.transitionTime: The time it takes to transition to the target pose.animationCurve: The animation curve to use for the transition.
SetPose()
Sets the target pose for the hand with various overloads for specifying the transition time and animation curve.
Parameters:
pose: The target pose data.transitionTime: (Optional) The time it takes to transition to the target pose. Default isdefaultPoseTransitionTime.animationCurve: (Optional) The animation curve to use for the transition. Default isdefaultPoseTransitionCurve.
GetCurrentHandPose()
Returns a reference to the current hand pose data, ignoring any objects being held.
Returns:
HandPoseData: A reference to the current hand pose data.
CopyHandData()
Copies the current hand pose data to the specified HandPoseData object, ignoring any objects being held.
Parameters:
handPose: TheHandPoseDataobject to copy the current hand pose data to.
CancelPose()
Cancels any ongoing pose transitions and returns the hand to its default state over a specified duration.
Parameters:
cancelPoseTransitionTime: (Optional) The time it takes to cancel the current pose transition. Default isdefaultPoseTransitionTime.
IsPosing()
Checks if the hand is currently locked into a pose.
Returns:
bool:Trueif the hand is currently posing, otherwiseFalse.
SetTargetPose()
Sets a new target pose for the hand to transition to, with specified transition time and animation curve.
Parameters:
poseData: The pose data to transition to.transitionTime: The duration of the transition.animationCurve: The animation curve for the transition.
SetPose()
Sets a new pose for the hand with optional transition time and animation curve.
Parameters:
pose: The pose data to set.transitionTime: The duration of the transition (optional).animationCurve: The animation curve for the transition (optional).
GetCurrentHandPose()
Gets the current pose of the hand.
Returns:
HandPoseData: A reference to the current hand pose data.
CopyHandData()
Copies the current hand pose data to the specified HandPoseData object.
Parameters:
handPose: The pose data to copy the current hand pose to.
CancelPose()
Cancels the current pose transition and reverts to the default pose.
Parameters:
cancelPoseTransitionTime: The time to transition back to the default pose (optional).
IsPosing()
Checks if the hand is currently in a pose transition or locked into a pose.
Returns:
bool:Trueif the hand is posing,Falseotherwise.
Last updated