Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flashing RiggedHandMesh #10754

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Assets/MRTK/Core/Interfaces/Devices/IMixedRealityHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ namespace Microsoft.MixedReality.Toolkit.Input
/// </summary>
public interface IMixedRealityHand : IMixedRealityController
{
/// <summary>
/// Has the hand any joint data available.
/// </summary>
bool IsJointDataAvailable { get; }

/// <summary>
/// Get the current pose of a hand joint.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions Assets/MRTK/Core/Providers/Hands/BaseHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ protected void UpdateVelocity()

#endregion Gesture Definitions

/// <inheritdoc />
public abstract bool IsJointDataAvailable { get; }

/// <inheritdoc />
public abstract bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose);

Expand Down
3 changes: 3 additions & 0 deletions Assets/MRTK/Core/Providers/InputSimulation/SimulatedHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ protected SimulatedHand(
: base(trackingState, controllerHandedness, inputSource, interactions, definition)
{ }

/// <inheritdoc/>
public override bool IsJointDataAvailable => jointPoses.Count > 0;

/// <inheritdoc />
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose) => jointPoses.TryGetValue(joint, out pose);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public LeapMotionArticulatedHand(

#region IMixedRealityHand Implementation

/// <inheritdoc />
public override bool IsJointDataAvailable => jointPoses.Count > 0;

/// <inheritdoc/>
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose) => jointPoses.TryGetValue(joint, out pose);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public override void SetupDefaultInteractions()
#region IMixedRealityHand Implementation

protected readonly Dictionary<TrackedHandJoint, MixedRealityPose> jointPoses = new Dictionary<TrackedHandJoint, MixedRealityPose>();

/// <inheritdoc/>
public override bool IsJointDataAvailable => jointPoses.Count > 0;

/// <inheritdoc/>
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public MicrosoftArticulatedHand(TrackingState trackingState, Handedness controll

#region IMixedRealityHand Implementation

/// <inheritdoc/>
public bool IsJointDataAvailable => unityJointPoses != null;

/// <inheritdoc/>
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public WindowsMixedRealityXRSDKArticulatedHand(

#region IMixedRealityHand Implementation

/// <inheritdoc/>
public bool IsJointDataAvailable => jointPoses != null;

/// <inheritdoc/>
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ protected override bool UpdateHandJoints()
MixedRealityHandTrackingProfile handTrackingProfile = inputSystem?.InputSystemProfile != null ? inputSystem.InputSystemProfile.HandTrackingProfile : null;

// Only runs if render hand mesh is true
bool renderHandmesh = handTrackingProfile != null && handTrackingProfile.EnableHandMeshVisualization;
bool renderHandmesh = handTrackingProfile != null && handTrackingProfile.EnableHandMeshVisualization && MixedRealityHand.IsJointDataAvailable;
HandRenderer.enabled = renderHandmesh;
if (renderHandmesh)
{
Expand Down