๐ซณ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 currentHandPoseArea
the hand is interacting with.
Properties
Hand Pose Data Non Alloc
: Returns a reference to the non-allocatedHandPoseData
used for temporary calculations.Open Hand Pose
: Returns a reference to theHandPoseData
representing the open hand pose.Close Hand Pose
: Returns a reference to theHandPoseData
representing the closed hand pose.Current Input Pose
: Returns a reference to theHandPoseData
representing the current input pose.Current Target Pose
: Returns a reference to theHandPoseData
representing the target pose the hand is transitioning to.Current Hand Pose
: Returns a reference to theHandPoseData
representing the current hand pose.Current Hand Smooth Pose
: Returns a reference to theHandPoseData
representing the smoothly interpolated hand pose.
Public Methods
SetTargetPose()
csharpCopy codepublic virtual void SetTargetPose(ref HandPoseData poseData, float transitionTime, AnimationCurve animationCurve)
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()
csharpCopy codepublic void SetPose(ref HandPoseData pose, float transitionTime, AnimationCurve animationCurve)
public void SetPose(ref HandPoseData pose, float transitionTime)
public void SetPose(ref HandPoseData pose)
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()
csharpCopy codepublic ref HandPoseData 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()
csharpCopy codepublic void CopyHandData(ref HandPoseData handPose)
Copies the current hand pose data to the specified HandPoseData
object, ignoring any objects being held.
Parameters:
handPose
: TheHandPoseData
object to copy the current hand pose data to.
CancelPose()
csharpCopy codepublic void CancelPose(float cancelPoseTransitionTime)
public void 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()
csharpCopy codepublic bool IsPosing()
Checks if the hand is currently locked into a pose.
Returns:
bool
:True
if the hand is currently posing, otherwiseFalse
.
SetTargetPose()
csharpCopy codepublic virtual void SetTargetPose(ref HandPoseData poseData, float transitionTime, AnimationCurve animationCurve)
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()
csharpCopy codepublic void SetPose(ref HandPoseData pose, float transitionTime, AnimationCurve animationCurve)
public void SetPose(ref HandPoseData pose, float transitionTime)
public void SetPose(ref HandPoseData pose)
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()
csharpCopy codepublic ref HandPoseData GetCurrentHandPose()
Gets the current pose of the hand.
Returns:
HandPoseData
: A reference to the current hand pose data.
CopyHandData()
csharpCopy codepublic void CopyHandData(ref HandPoseData handPose)
Copies the current hand pose data to the specified HandPoseData
object.
Parameters:
handPose
: The pose data to copy the current hand pose to.
CancelPose()
csharpCopy codepublic void CancelPose(float cancelPoseTransitionTime)
public void 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()
csharpCopy codepublic bool IsPosing()
Checks if the hand is currently in a pose transition or locked into a pose.
Returns:
bool
:True
if the hand is posing,False
otherwise.
Last updated