-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version defines for key vibration. This allows the keyboard to be…
… used on other xr platforms
- Loading branch information
1 parent
9f65bfd
commit 5dc322c
Showing
16 changed files
with
2,031 additions
and
3,452 deletions.
There are no files selected for viewing
2,463 changes: 835 additions & 1,628 deletions
2,463
Assets/MagicLeap/KeyboardExample/Scenes/XRKeyboardExample.unity
Large diffs are not rendered by default.
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
52 changes: 52 additions & 0 deletions
52
Packages/MagicLeapXRKeyboard/Runtime/Scripts/Extensions/XRInteractionExtensions.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,52 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.XR.Interaction.Toolkit; | ||
|
||
namespace MagicLeap.Common | ||
{ | ||
public static class XRInteractionExtensions | ||
{ | ||
/// <summary> | ||
/// Adds colliders to the interactable. | ||
/// </summary> | ||
/// <param name="xrInteractable"></param> | ||
/// <param name="colliders"></param> | ||
/// <param name="clearCurrentColliders"></param> | ||
public static void AddColliders(this XRBaseInteractable xrInteractable, Collider[] colliders, bool clearCurrentColliders = false) | ||
{ | ||
if (clearCurrentColliders) | ||
{ | ||
xrInteractable.colliders.Clear(); | ||
} | ||
|
||
foreach (Collider handleCollider in colliders) | ||
{ | ||
|
||
if (!xrInteractable.colliders.Contains(handleCollider)) | ||
{ | ||
|
||
xrInteractable.colliders.Add(handleCollider); | ||
} | ||
} | ||
|
||
xrInteractable.ReRegisterInteractable(); | ||
} | ||
|
||
public static void ReRegisterInteractable(this XRBaseInteractable xrInteractable) | ||
{ | ||
xrInteractable.StartCoroutine(ReRegisterInteractableCoroutine(xrInteractable)); | ||
} | ||
|
||
private static IEnumerator ReRegisterInteractableCoroutine(this XRBaseInteractable xrInteractable) | ||
{ | ||
yield return new WaitForEndOfFrame(); | ||
xrInteractable.interactionManager.UnregisterInteractable(xrInteractable as IXRInteractable); | ||
|
||
yield return new WaitForEndOfFrame(); | ||
xrInteractable.interactionManager.RegisterInteractable(xrInteractable as IXRInteractable); | ||
|
||
yield return null; | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Packages/MagicLeapXRKeyboard/Runtime/Scripts/Extensions/XRInteractionExtensions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.