@@ -23,7 +23,7 @@ namespace Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality
2323 [ MixedRealityController (
2424 SupportedControllerType . ArticulatedHand ,
2525 new [ ] { Handedness . Left , Handedness . Right } ) ]
26- public class WindowsMixedRealityXRSDKArticulatedHand : BaseWindowsMixedRealityXRSDKSource
26+ public class WindowsMixedRealityXRSDKArticulatedHand : BaseWindowsMixedRealityXRSDKSource , IMixedRealityHand
2727 {
2828 /// <summary>
2929 /// Constructor.
@@ -280,6 +280,46 @@ private TrackedHandJoint ConvertToTrackedHandJoint(HandFinger finger, int index)
280280 }
281281 }
282282
283+ #region IMixedRealityHand Implementation
284+
285+ /// <inheritdoc/>
286+ public bool TryGetJoint ( TrackedHandJoint joint , out MixedRealityPose pose ) => unityJointPoses . TryGetValue ( joint , out pose ) ;
287+
288+ #endregion IMixedRealityHand Implementation
289+
290+ private readonly float CursorBeamBackwardTolerance = 0.5f ;
291+ private readonly float CursorBeamUpTolerance = 0.8f ;
292+
293+ /// <inheritdoc/>
294+ public override bool IsInPointingPose
295+ {
296+ get
297+ {
298+ bool valid = true ;
299+ MixedRealityPose palmJoint ;
300+ if ( unityJointPoses . TryGetValue ( TrackedHandJoint . Palm , out palmJoint ) )
301+ {
302+ Vector3 palmNormal = palmJoint . Rotation * ( - 1 * Vector3 . up ) ;
303+ if ( CursorBeamBackwardTolerance >= 0 )
304+ {
305+ Vector3 cameraBackward = - CameraCache . Main . transform . forward ;
306+ if ( Vector3 . Dot ( palmNormal . normalized , cameraBackward ) > CursorBeamBackwardTolerance )
307+ {
308+ valid = false ;
309+ }
310+ }
311+ if ( valid && CursorBeamUpTolerance >= 0 )
312+ {
313+ if ( Vector3 . Dot ( palmNormal , Vector3 . up ) > CursorBeamUpTolerance )
314+ {
315+ valid = false ;
316+ }
317+ }
318+ }
319+ return valid ;
320+ }
321+ }
322+
283323 #endregion Update data functions
284324 }
285325}
0 commit comments