class MAGES::Interaction::HandPose¶
Overview¶
A predefined HandPose for a hand. More…
class HandPose: public ScriptableObject { public: // properties int HandIndex; Pose LocalPose; IEnumerable<FingerPose> FingerPoses; // methods static HandPose operator + (HandPose p1, HandPose p2); static HandPose operator - (HandPose p1, HandPose p2); static bool operator == (HandPose p1, HandPose p2); static bool operator != (HandPose p1, HandPose p2); static HandPose Lerp(HandPose p1, HandPose p2, float t); static void LerpNonAlloc(HandPose p1, HandPose p2, float t, HandPose result); static HandPose Combine(HandPose p1, HandPose p2); bool TryGetFingerPose(int fingerIndex, out FingerPose pose); FingerPose GetFingerPose(int fingerIndex); bool ContainsFingerPose(int fingerIndex); void AddFingerPose(FingerPose pose); void RemoveFingerPose(FingerPose pose); void RemoveFingerPose(int fingerIndex); void ClearFingerPoses(); void CopyValuesFrom(HandPose pose); override bool Equals(object other); override int GetHashCode(); };
Detailed Documentation¶
A predefined HandPose for a hand.
Properties¶
int HandIndex
Gets or sets the index of the hand this pose is for.
Pose LocalPose
Gets or sets the local Pose of the hand relative to the gameobject this pose is for.
IEnumerable<FingerPose> FingerPoses
Gets the finger poses.
Methods¶
static HandPose operator + (HandPose p1, HandPose p2)
Combines the two hand poses.
This can be used in cases where one handpose contains some fingers and the other the rest, in order to combine them. If both hand poses contain the same finger, the one from the first hand pose will be used.
Parameters:
p1 |
The first handpose. |
p2 |
The second handpose. |
Returns:
The combined hand pose.
static HandPose operator - (HandPose p1, HandPose p2)
Removes from the hand pose p1 the fingers contained in the handpose p2.
This can be used in cases where one handpose contains some fingers and the other the rest, in order to mask them.
Parameters:
p1 |
The first handpose. |
p2 |
The second handpose. |
Returns:
The new hand pose.
static bool operator == (HandPose p1, HandPose p2)
Checks if two hand poses are equal. Equality is defined as having the same HandIndex, LocalPose and by calling the Equals operator for each finger pose in FingerPoses.
Parameters:
p1 |
Hand pose 1. |
p2 |
Hand pose 2. |
Returns:
true
if equal.
static bool operator != (HandPose p1, HandPose p2)
Checks if two hand poses are not equal. Equality is defined as having the same HandIndex, LocalPose and by calling the Equals operator for each finger pose in FingerPoses.
Parameters:
p1 |
Hand pose 1. |
p2 |
Hand pose 2. |
Returns:
true
if not equal.
static HandPose Lerp(HandPose p1, HandPose p2, float t)
Lerps between the two hand poses.
Parameters:
p1 |
HandPose 1. |
p2 |
HandPose 2. |
t |
Interpolation factor. A value between 0 and 1. |
Returns:
The interpolated hand pose.
static void LerpNonAlloc(HandPose p1, HandPose p2, float t, HandPose result)
Lerps between p1 and p2 and stores the result in result.
Parameters:
p1 |
HandPose 1. |
p2 |
HandPose 2. |
t |
Interpolation factor. A value between 0 and 1. |
result |
The HandPose where the result will be stored. |
static HandPose Combine(HandPose p1, HandPose p2)
Combines the two hand poses.
This can be used in cases where one handpose contains some fingers and the other the rest, in order to combine them. If both hand poses contain the same finger, the one from the first hand pose will be used.
Parameters:
p1 |
The first handpose. |
p2 |
The second handpose. |
Returns:
The combined hand pose.
bool TryGetFingerPose(int fingerIndex, out FingerPose pose)
Tries to find and get the finger pose for the given finger index.
Parameters:
fingerIndex |
The finger index to get the pose for. |
pose |
The pose that was found, if any. |
Returns:
true
if the requested finger pose was found.
FingerPose GetFingerPose(int fingerIndex)
Returns the finger pose for the given finger index.
Parameters:
fingerIndex |
The finger index to get the pose for. |
Returns:
The requested finger pose or null if not found.
bool ContainsFingerPose(int fingerIndex)
Gets if this handpose contains a FingerPose for the given finger index.
Parameters:
fingerIndex |
The index for the finger pose to check for. |
Returns:
true
if the HandPose contains a FingerPose for this index.
void AddFingerPose(FingerPose pose)
Adds the given finger pose for the given finger index.
If a pose with the same finger index exits, it will override it.
Parameters:
pose |
The pose to add. |
void RemoveFingerPose(FingerPose pose)
Removes the pose from the saved finger poses.
The pose must be contained in the handpose.
Parameters:
pose |
The pose to remove. |
void RemoveFingerPose(int fingerIndex)
Removes the finger pose with the given fingerIndex from the saved finger poses.
Parameters:
fingerIndex |
The finger index of the pose to remove. |
void ClearFingerPoses()
Removes all saved finger poses.
void CopyValuesFrom(HandPose pose)
Copies all the finger poses from the given hand pose to this.
Parameters:
pose |
The pose to get the values from. |
override bool Equals(object other)
Checks if this hand pose is equal to the given object.
Equality is defined as having the same HandIndex, LocalPose and by calling the Equals operator for each finger pose in FingerPoses.
Parameters:
other |
The object to compare to. |
Returns:
true
if the two hand poses are the same.
override int GetHashCode()
Gets the hash code for this hand pose.
Returns:
The hashcode.