diff --git a/Editor/HPUIBaseInteractableEditor.cs b/Editor/HPUIBaseInteractableEditor.cs index 3a7df49..ec7fdd1 100644 --- a/Editor/HPUIBaseInteractableEditor.cs +++ b/Editor/HPUIBaseInteractableEditor.cs @@ -5,6 +5,7 @@ namespace ubco.ovilab.HPUI.Editor { + [CanEditMultipleObjects] [CustomEditor(typeof(HPUIBaseInteractable), true)] public class HPUIBaseInteractableEditor: XRBaseInteractableEditor { @@ -55,8 +56,11 @@ protected override List GetDerivedSerializedPropertyNames() return props; } + // Selection mode and distance calculation mode are programatically set. /// - protected override void DrawSelectionConfiguration() - {} + protected override void DrawSelectionConfiguration() { } + + /// + protected override void DrawDistanceCalculationMode() { } } } diff --git a/Editor/HPUIContinuousInteractableEditor.cs b/Editor/HPUIContinuousInteractableEditor.cs index 7d7b2fa..14e93e4 100644 --- a/Editor/HPUIContinuousInteractableEditor.cs +++ b/Editor/HPUIContinuousInteractableEditor.cs @@ -6,11 +6,16 @@ namespace ubco.ovilab.HPUI.Editor { + [CanEditMultipleObjects] [CustomEditor(typeof(HPUIContinuousInteractable), true)] public class HPUIContinuousInteractableEditor: HPUIBaseInteractableEditor { private HPUIContinuousInteractable t; - protected override List EventPropertyNames => base.EventPropertyNames.Union(new List() { "continuousSurfaceCreatedEvent" }).ToList(); + protected override List EventPropertyNames => base.EventPropertyNames.Union(new List() + { + "continuousSurfaceCreatedEvent", + "boundsCollider" // NOTE: this is not relevant to the HPUIContinuousInteractable. + }).ToList(); protected override void OnEnable() { @@ -24,7 +29,10 @@ public override void OnInspectorGUI() GUI.enabled = EditorApplication.isPlaying; if (GUILayout.Button("Run calibration")) { - t.Configure(); + foreach (Object t in targets) + { + (t as HPUIContinuousInteractable)?.Configure(); + } } GUI.enabled = true; } diff --git a/Editor/HPUIInteractorEditor.cs b/Editor/HPUIInteractorEditor.cs index ba793d2..a12a8c3 100644 --- a/Editor/HPUIInteractorEditor.cs +++ b/Editor/HPUIInteractorEditor.cs @@ -5,6 +5,7 @@ namespace ubco.ovilab.HPUI.Editor { + [CanEditMultipleObjects] [CustomEditor(typeof(HPUIInteractor), true)] public class HPUIInteractorEditor: XRBaseInteractorEditor { diff --git a/Runtime/Interaction/HPUIBaseInteractable.cs b/Runtime/Interaction/HPUIBaseInteractable.cs index 745f478..2e14153 100644 --- a/Runtime/Interaction/HPUIBaseInteractable.cs +++ b/Runtime/Interaction/HPUIBaseInteractable.cs @@ -23,7 +23,14 @@ public Handedness Handedness set => handedness = value; } - public Collider boundsCollider; + [SerializeField] + private Collider boundsCollider; + + /// + /// The collider used to compute the bounds of the interactable. + /// /// + /// + public Collider BoundsCollider { get => boundsCollider; set => boundsCollider = value; } [SerializeField] private int _zOrder; @@ -76,13 +83,13 @@ protected override void OnEnable() /// protected virtual void ComputeSurfaceBounds() { - if (boundsCollider == null) + if (BoundsCollider == null) { - boundsCollider = colliders[0]; - Debug.LogWarning($"boundsCollider is not set. Using {boundsCollider.name}'s collider."); + BoundsCollider = colliders[0]; + Debug.LogWarning($"boundsCollider is not set. Using {BoundsCollider.name}'s collider."); } - Bounds colliderBounds = boundsCollider.bounds; + Bounds colliderBounds = BoundsCollider.bounds; Transform interactableTransform = GetAttachTransform(null); boundsMax = ComputeTargetPointOnInteractablePlane(colliderBounds.max, interactableTransform); boundsMin = ComputeTargetPointOnInteractablePlane(colliderBounds.min, interactableTransform);