File tree Expand file tree Collapse file tree 4 files changed +16
-9
lines changed
MixedRealityToolkit-SDK/Features/UX/Scripts/Pointers
MixedRealityToolkit/_Core/Devices/UnityInput Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -144,11 +144,8 @@ protected override async void Start()
144144 MixedRealityManager . TeleportSystem . Register ( gameObject ) ;
145145 }
146146
147- if ( MixedRealityManager . InputSystem == null )
148- {
149- await WaitUntilInputSystemValid ;
150- SetCursor ( ) ;
151- }
147+ await WaitUntilInputSystemValid ;
148+ SetCursor ( ) ;
152149 }
153150
154151 protected override void OnDisable ( )
@@ -311,10 +308,14 @@ public virtual bool TryGetPointingRay(out Ray pointingRay)
311308 {
312309 Vector3 pointerPosition ;
313310 TryGetPointerPosition ( out pointerPosition ) ;
314- pointingRay = new Ray ( pointerPosition , PointerDirection ) ;
311+ pointingRay = pointerRay ;
312+ pointingRay . origin = pointerPosition ;
313+ pointingRay . direction = PointerDirection ;
315314 return true ;
316315 }
317316
317+ private readonly Ray pointerRay = new Ray ( ) ;
318+
318319 /// <inheritdoc />
319320 public virtual bool TryGetPointerRotation ( out Quaternion rotation )
320321 {
Original file line number Diff line number Diff line change @@ -78,7 +78,6 @@ public override void OnSourcePoseChanged(SourcePoseEventData<Vector2> eventData)
7878 /// <inheritdoc />
7979 public override void OnPositionInputChanged ( InputEventData < Vector2 > eventData )
8080 {
81-
8281 if ( eventData . SourceId == Controller ? . InputSource . SourceId )
8382 {
8483 if ( ! UseSourcePoseData &&
Original file line number Diff line number Diff line change @@ -67,8 +67,11 @@ public void Update()
6767 return ;
6868 }
6969
70- controllerPose . Position = InputSource . Pointers [ 0 ] . BaseCursor . Position ;
71- controllerPose . Rotation = InputSource . Pointers [ 0 ] . BaseCursor . Rotation ;
70+ if ( InputSource . Pointers [ 0 ] . BaseCursor != null )
71+ {
72+ controllerPose . Position = InputSource . Pointers [ 0 ] . BaseCursor . Position ;
73+ controllerPose . Rotation = InputSource . Pointers [ 0 ] . BaseCursor . Rotation ;
74+ }
7275
7376 // Don't ask me why it's mapped weird. Bc Unity...
7477 mouseDelta . x = Input . GetAxis ( "Mouse X" ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ public override void Enable()
2929 return ;
3030 }
3131
32+ #if UNITY_EDITOR
33+ UnityEditor . EditorWindow . focusedWindow . ShowNotification ( new GUIContent ( "Press \" ESC\" to regain mouse control" ) ) ;
34+ #endif
35+
3236 Cursor . visible = false ;
3337 Cursor . lockState = CursorLockMode . Locked ;
3438
You can’t perform that action at this time.
0 commit comments