-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix jaggy hand pose transition when an interactable overrides the han…
…d pose to use (#141) * Fix source pose not filtering for source ID * Fix hand pose override is detected too late and causes jaggy transition * Clean up profile
- Loading branch information
Showing
10 changed files
with
175 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) Reality Collective. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
namespace RealityToolkit.Input.Hands.Poses | ||
{ | ||
/// <summary> | ||
/// Identifies and implementation that provides <see cref="HandPose"/>s to <see cref="Visualizers.BaseHandControllerVisualizer"/>s. | ||
/// </summary> | ||
public interface IProvideHandPose | ||
{ | ||
/// <summary> | ||
/// Optional focus <see cref="HandPose"/> override. | ||
/// </summary> | ||
HandPose FocusPose { get; } | ||
|
||
/// <summary> | ||
/// Optional select <see cref="HandPose"/> override. | ||
/// </summary> | ||
HandPose SelectPose { get; } | ||
|
||
/// <summary> | ||
/// Optional grab <see cref="HandPose"/> override. | ||
/// </summary> | ||
HandPose GrabPose { get; } | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
Runtime/Input/InteractionBehaviours/SelectHandPoseBehaviour.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using RealityToolkit.Input.Events; | ||
using RealityToolkit.Input.Hands.Poses; | ||
using RealityToolkit.Input.Hands.Visualizers; | ||
using RealityToolkit.Input.Interactors; | ||
using UnityEngine; | ||
|
||
namespace RealityToolkit.Input.InteractionBehaviours | ||
{ | ||
/// <summary> | ||
/// The <see cref="SelectHandPoseBehaviour"/> will animate the <see cref="RiggedHandControllerVisualizer"/> | ||
/// into the assigned <see cref="selectPose"/>, when the <see cref="Interactables.IInteractable"/> is selected. | ||
[HelpURL("https://www.realitytoolkit.io/docs/interactions/interaction-behaviours/default-behaviours/select-hand-pose-behaviour")] | ||
[AddComponentMenu(RealityToolkitRuntimePreferences.Toolkit_InteractionsAddComponentMenu + "/" + nameof(SelectHandPoseBehaviour))] | ||
public class SelectHandPoseBehaviour : BaseInteractionBehaviour, IProvideHandPose | ||
{ | ||
[SerializeField, Tooltip("Select pose applied when selecting the interactable.")] | ||
private HandPose selectPose = null; | ||
|
||
/// <inheritdoc/> | ||
public HandPose FocusPose { get; } = null; | ||
|
||
/// <inheritdoc/> | ||
public HandPose SelectPose => selectPose; | ||
|
||
/// <inheritdoc/> | ||
public HandPose GrabPose { get; } = null; | ||
|
||
/// <inheritdoc/> | ||
protected override void OnSelectEntered(InteractionEventArgs eventArgs) | ||
{ | ||
if (eventArgs.Interactor is IDirectInteractor directInteractor && | ||
directInteractor.Controller.Visualizer is RiggedHandControllerVisualizer riggedHandControllerVisualizer) | ||
{ | ||
riggedHandControllerVisualizer.OverridePose = selectPose; | ||
} | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void OnSelectExited(InteractionExitEventArgs eventArgs) | ||
{ | ||
if (eventArgs.Interactor is IDirectInteractor directInteractor && | ||
directInteractor.Controller.Visualizer is RiggedHandControllerVisualizer riggedHandControllerVisualizer) | ||
{ | ||
riggedHandControllerVisualizer.OverridePose = null; | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Runtime/Input/InteractionBehaviours/SelectHandPoseBehaviour.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.