@@ -30,12 +30,6 @@ public class PokePointer : BaseControllerPointer, IMixedRealityNearPointer
3030 /// </summary>
3131 private const int maximumTouchableVolumeSize = 1000 ;
3232
33- [ SerializeField ]
34- protected LineRenderer line ;
35-
36- [ SerializeField ]
37- protected GameObject visuals ;
38-
3933 [ SerializeField ]
4034 [ Tooltip ( "Maximum distance a which a touchable surface can be interacted with." ) ]
4135 protected float touchableDistance = 0.2f ;
@@ -96,6 +90,9 @@ public bool IgnoreCollidersNotInFOV
9690 private float closestDistance = 0.0f ;
9791
9892 private Vector3 closestNormal = Vector3 . forward ;
93+
94+ private Vector3 endPoint ;
95+
9996 // previous frame pointer position
10097 public Vector3 PreviousPosition { get ; private set ; } = Vector3 . zero ;
10198
@@ -173,9 +170,6 @@ public override void OnPreSceneQuery()
173170 Vector3 start = Position + lengthOfPointerRay * closestNormal ;
174171 Vector3 end = Position - lengthOfPointerRay * closestNormal ;
175172 Rays [ 0 ] . UpdateRayStep ( ref start , ref end ) ;
176-
177- line . SetPosition ( 0 , Position ) ;
178- line . SetPosition ( 1 , end ) ;
179173 }
180174
181175 // Check if the currently touched object is still part of the new touchable.
@@ -190,8 +184,6 @@ public override void OnPreSceneQuery()
190184 // Set new touchable only now: If we have to raise a poke-up event for the previous touchable object,
191185 // we need to do so using the previous touchable in TryRaisePokeUp().
192186 closestProximityTouchable = newClosestTouchable ;
193-
194- visuals . SetActive ( IsActive ) ;
195187 }
196188 }
197189
@@ -302,19 +294,6 @@ public override void OnPostSceneQuery()
302294 }
303295 }
304296
305- if ( ! IsNearObject )
306- {
307- line . endColor = line . startColor = new Color ( 1 , 1 , 1 , 0.25f ) ;
308- }
309- else if ( currentTouchableObjectDown == null )
310- {
311- line . endColor = line . startColor = new Color ( 1 , 1 , 1 , 0.75f ) ;
312- }
313- else
314- {
315- line . endColor = line . startColor = new Color ( 0 , 0 , 1 , 0.75f ) ;
316- }
317-
318297 PreviousPosition = Position ;
319298 }
320299 }
@@ -492,9 +471,23 @@ protected override void OnEnable()
492471 base . OnEnable ( ) ;
493472
494473 IsTargetPositionLockedOnFocusLock = false ;
474+ }
475+
476+ private void OnDrawGizmos ( )
477+ {
478+ if ( ! IsNearObject )
479+ {
480+ return ;
481+ }
482+ else
483+ {
484+ Gizmos . color = Color . green ;
485+ }
495486
496- Debug . Assert ( line != null , "No line renderer found in PokePointer." ) ;
497- Debug . Assert ( visuals != null , "No visuals object found in PokePointer." ) ;
487+ if ( closestProximityTouchable != null )
488+ {
489+ Gizmos . DrawLine ( transform . position , closestProximityTouchable . transform . position ) ;
490+ }
498491 }
499492 }
500493}
0 commit comments