-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding IsProximityHovered property of type TimedFlag to detect when a…
… button starts being hovered or on interactor proximity and when it stops being hovered or on proximity of any interactor. (#611) Adding ProximityHover events (Entered & Exited) to PressableButton class.
- Loading branch information
1 parent
60a315d
commit bbdc68f
Showing
14 changed files
with
357 additions
and
10 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
40 changes: 40 additions & 0 deletions
40
org.mixedrealitytoolkit.input/InteractionModes/BaseProximityEventArgs.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,40 @@ | ||
using System; | ||
using UnityEngine; | ||
using UnityEngine.XR.Interaction.Toolkit; | ||
|
||
namespace MixedReality.Toolkit.Input | ||
{ | ||
/// <summary> | ||
/// Event data associated with proximity events triggered by a Collider and an Interactor combo. | ||
/// </summary> | ||
public abstract partial class BaseProximityEventArgs : EventArgs | ||
{ | ||
/// <summary> | ||
/// Constructor for BaseProximityEventArgs. | ||
/// </summary> | ||
/// <param name="sender">Source of event.</param> | ||
/// <param name="collider">Collider that triggers proximity event.</param> | ||
/// <param name="interactor">XRBaseInteractor that triggers proximity event.</param> | ||
public BaseProximityEventArgs(object sender, Collider collider, XRBaseInteractor interactor) | ||
{ | ||
this.sender = sender; | ||
this.collider = collider; | ||
this.interactor = interactor; | ||
} | ||
|
||
/// <summary> | ||
/// The object that triggered the proximity event. | ||
/// </summary> | ||
public object sender { get; private set; } | ||
|
||
/// <summary> | ||
/// The collider associated with the interaction event. | ||
/// </summary> | ||
public Collider collider { get; private set; } | ||
|
||
/// <summary> | ||
/// The interactor associated with the interaction event. | ||
/// </summary> | ||
public XRBaseInteractor interactor { get; private set; } | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
org.mixedrealitytoolkit.input/InteractionModes/BaseProximityEventArgs.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
org.mixedrealitytoolkit.input/InteractionModes/IXRProximityInteractable.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,32 @@ | ||
// Copyright (c) Mixed Reality Toolkit Contributors | ||
// Licensed under the BSD 3-Clause | ||
|
||
using UnityEngine; | ||
using UnityEngine.XR.Interaction.Toolkit; | ||
|
||
namespace MixedReality.Toolkit.Input | ||
{ | ||
/// <summary> | ||
/// This interface is used to update the enable state of the Components that are in the <see cref="ProximityEnabledComponents"/> | ||
/// array (set in Editor) and to keep track of which <see cref="Collider"/> and <see cref="XRBaseInteractor"/> duples are triggering proximity. | ||
/// </summary> | ||
/// <remarks> | ||
/// This interface is needed to prevent a circular reference between MRTK Input and MRTK UX Core Scripts packages. | ||
/// </remarks> | ||
public interface IXRProximityInteractable | ||
{ | ||
/// <summary> | ||
/// Registers the duple Collider + XRBaseInteractor as triggering proximity. | ||
/// </summary> | ||
/// <param name="collider">Collider triggering proximity.</param> | ||
/// <param name="xrBaseInteractor">Interactor triggering proximity.</param> | ||
void OnProximityEntered(ProximityEnteredEventArgs args); | ||
|
||
/// <summary> | ||
/// Unregisters the duple Collider + XRBaseInteractor as triggering proximity. | ||
/// </summary> | ||
/// <param name="collider">Collider that in combination with the interactor was triggering proximity.</param> | ||
/// <param name="xrBaseInteractor">Interactor that in combination with the collider was triggering proximity.</param> | ||
void OnProximityExited(ProximityExitedEventArgs args); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
org.mixedrealitytoolkit.input/InteractionModes/IXRProximityInteractable.cs.meta
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
29 changes: 29 additions & 0 deletions
29
org.mixedrealitytoolkit.input/InteractionModes/ProximityEnteredEventArgs.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,29 @@ | ||
using UnityEngine; | ||
using UnityEngine.XR.Interaction.Toolkit; | ||
|
||
namespace MixedReality.Toolkit.Input | ||
{ | ||
public class ProximityEnteredEventArgs : BaseProximityEventArgs | ||
{ | ||
/// <summary> | ||
/// Constructor for ProximityEnteredArgs. | ||
/// </summary> | ||
/// <param name="sender">Source of event.</param> | ||
/// <param name="collider">Collider associated with the Proximity Entered event.</param> | ||
/// <param name="interactor">Interactor associated with the Proximity Entered event.</param> | ||
public ProximityEnteredEventArgs(object sender, Collider collider, XRBaseInteractor interactor) : base(sender, collider, interactor) | ||
{ | ||
//Empty on purpose | ||
} | ||
|
||
/// <summary> | ||
/// The collider associated with the proximity entered event. | ||
/// </summary> | ||
public new Collider collider => base.collider; | ||
|
||
/// <summary> | ||
/// The Interactor associated with the proximity entered event. | ||
/// </summary> | ||
public new XRBaseInteractor interactor => base.interactor; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
org.mixedrealitytoolkit.input/InteractionModes/ProximityEnteredEventArgs.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
org.mixedrealitytoolkit.input/InteractionModes/ProximityExitedEventArgs.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,29 @@ | ||
using UnityEngine; | ||
using UnityEngine.XR.Interaction.Toolkit; | ||
|
||
namespace MixedReality.Toolkit.Input | ||
{ | ||
public class ProximityExitedEventArgs : BaseProximityEventArgs | ||
{ | ||
/// <summary> | ||
/// Constructor for ProximityExitedArgs. | ||
/// </summary> | ||
/// <param name="sender">Source of event.</param> | ||
/// <param name="collider">Collider associated with the Proximity Exited event.</param> | ||
/// <param name="interactor">Interactor associated with the Proximity Exited event.</param> | ||
public ProximityExitedEventArgs(object sender, Collider collider, XRBaseInteractor interactor) : base(sender, collider, interactor) | ||
{ | ||
//Empty on purpose | ||
} | ||
|
||
/// <summary> | ||
/// The Collider associated with the proximity exited event. | ||
/// </summary> | ||
public new Collider collider => base.collider; | ||
|
||
/// <summary> | ||
/// The Interactor associated with the proximity exited event. | ||
/// </summary> | ||
public new XRBaseInteractor interactor => base.interactor; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
org.mixedrealitytoolkit.input/InteractionModes/ProximityExitedEventArgs.cs.meta
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
Oops, something went wrong.