diff --git a/Documentation~/docs/usage.md b/Documentation~/docs/usage.md index c03a5c4..598cf39 100644 --- a/Documentation~/docs/usage.md +++ b/Documentation~/docs/usage.md @@ -3,10 +3,10 @@ This can be imported as a git package in Unity. The package is built to use [Uni ## Scene setup - Setup the Scene with an XR Origin & XR Interaction Manager (see documentation [XRI documentation for more details](https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/manual/general-setup.html#create-the-xr-origin-camera-rig-for-tracked-devices)). -- Add the `HandJointData` in the scene. - Setup the `HPUIInteractor` - For each hand, add `hpuiinteractorright` and `HPUIInteractorLeft` prefabs to the scene. - Setup an HPUI Interactable. (TODO) + - HPUIInteractor is an extention of `XRPokeInteractor`. You would be able to use `XRPokeFilter` on any of the HPUI Interactables. Note that, with the `HPUIContinuousInteractable`, the associated `XRPokeFilter` needs to be enabled after the surface is created. By default, once the surface is created, it will enable any XRPokeFilter component on the same GameObject, right before `continuousSurfaceCreatedEvent` is invoked. ## Interactables TODO diff --git a/Runtime/Interaction/HPUIContinuousInteractable.cs b/Runtime/Interaction/HPUIContinuousInteractable.cs index 3930cdb..2cb5728 100644 --- a/Runtime/Interaction/HPUIContinuousInteractable.cs +++ b/Runtime/Interaction/HPUIContinuousInteractable.cs @@ -4,6 +4,7 @@ using UnityEngine; using UnityEngine.XR.Hands; using UnityEngine.XR.Interaction.Toolkit; +using UnityEngine.XR.Interaction.Toolkit.Filtering; namespace ubco.ovilab.HPUI.Interaction { @@ -68,6 +69,10 @@ protected override void Awake() /// public override Transform GetAttachTransform(IXRInteractor interactor) { + if (interactor == null) + { + return this.transform; + } // NOTE: This also should allow the XRPokeFilter to work with ContinuousInteractable, I think! return GetDistance(interactor.GetAttachTransform(this).transform.position).collider.transform; } @@ -182,6 +187,11 @@ private IEnumerator DelayedExecuteCalibration(float x_size, float y_size, List(); + if (pokeFilter != null) + { + pokeFilter.enabled = true; + } continuousSurfaceCreatedEvent?.Invoke(new HPUIContinuousSurfaceCreatedEventArgs(this)); } }