namespace UnityEngine.XR.Hands.Gestures
{
///
/// Description of a hand pose, which is and
/// .
///
[CreateAssetMenu(fileName = "New Hand Pose", menuName = "XR/Hand Interactions/Hand Pose")]
public class XRHandPose : ScriptableObject
{
[SerializeField]
[Tooltip("Hand shape to check for this pose.")]
XRHandShape m_HandShape;
[SerializeField]
[Tooltip("User- and target-relative hand orientation conditions to check for this pose.")]
XRHandRelativeOrientation m_RelativeOrientation;
///
/// The required for this hand pose.
///
public XRHandShape handShape
{
get => m_HandShape;
set => m_HandShape = value;
}
///
/// The required for this hand pose.
///
public XRHandRelativeOrientation relativeOrientation
{
get => m_RelativeOrientation;
set => m_RelativeOrientation = value;
}
///
/// Check the hand shape against the given updated hand joint data.
///
///
/// The check will end early if the hand is not tracked or after the
/// first finger shape condition is found to be .
/// The order of the conditions will determine the order they are
/// checked.
///
///
/// The hand joints updated event arguments to reference for the
/// latest hand.
///
///
/// Returns if all the finger shape conditions
/// are met. Otherwise, returns if any condition
/// is not met.
///
public bool CheckConditions(XRHandJointsUpdatedEventArgs eventArgs)
{
var hand = eventArgs.hand;
return hand.isTracked &&
m_HandShape != null && m_HandShape.CheckConditions(eventArgs) &&
m_RelativeOrientation.CheckConditions(hand.rootPose, hand.handedness);
}
}
}