@@ -64,8 +64,8 @@ public class HPUIInteractor: XRBaseInteractor, IHPUIInteractor
64
64
private bool justStarted = false ;
65
65
private Vector3 lastInteractionPoint ;
66
66
private PhysicsScene physicsScene ;
67
- private RaycastHit [ ] sphereCastHits = new RaycastHit [ 25 ] ;
68
- private Collider [ ] overlapSphereHits = new Collider [ 25 ] ;
67
+ private RaycastHit [ ] sphereCastHits = new RaycastHit [ 200 ] ;
68
+ private Collider [ ] overlapSphereHits = new Collider [ 200 ] ;
69
69
70
70
/// <inheritdoc />
71
71
protected override void Awake ( )
@@ -130,6 +130,7 @@ public override void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase u
130
130
// If no movement is recorded.
131
131
// Check if spherecast size is sufficient for proper cast, or if first frame since last frame poke position will be invalid.
132
132
int numberOfOverlaps ;
133
+ List < Collider > colliders ;
133
134
134
135
if ( justStarted || overlapSqrMagnitude < 0.001f )
135
136
{
@@ -141,6 +142,7 @@ public override void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase u
141
142
Physics . AllLayers ,
142
143
// FIXME: QueryTriggerInteraction should be allowed to be set in inpsector
143
144
QueryTriggerInteraction . Ignore ) ;
145
+ colliders = overlapSphereHits . ToList ( ) ;
144
146
}
145
147
else
146
148
{
@@ -154,17 +156,17 @@ public override void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase u
154
156
Physics . AllLayers ,
155
157
// FIXME: QueryTriggerInteraction should be allowed to be set in inpsector
156
158
QueryTriggerInteraction . Ignore ) ;
157
-
159
+ colliders = sphereCastHits . Select ( s => s . collider ) . ToList ( ) ;
158
160
}
159
161
160
162
lastInteractionPoint = pokeInteractionPoint ;
161
163
justStarted = false ;
162
164
163
165
for ( var i = 0 ; i < numberOfOverlaps ; ++ i )
164
166
{
165
- if ( interactionManager . TryGetInteractableForCollider ( sphereCastHits [ i ] . collider , out var interactable ) &&
166
- interactable is IXRSelectInteractable selectable &&
167
- interactable is IXRHoverInteractable hoverable && hoverable . IsHoverableBy ( this ) )
167
+ if ( interactionManager . TryGetInteractableForCollider ( colliders [ i ] , out var interactable ) &&
168
+ ! validTargets . Contains ( interactable ) &&
169
+ interactable is IHPUIInteractable hpuiInteractable && hpuiInteractable . IsHoverableBy ( this ) )
168
170
{
169
171
validTargets . Add ( interactable ) ;
170
172
}
0 commit comments