File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Packages/webxr-interactions Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [ Unreleased]
8
8
9
+ ### Fixed
10
+ - No reference to controllers in SceneHitTest.
11
+
9
12
## [ 0.16.0] - 2023-02-02
10
13
### Added
11
14
- Spectator Camera.
Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ public class SceneHitTest : MonoBehaviour
6
6
{
7
7
public Transform originTransform ;
8
8
public GameObject visual ;
9
+ [ SerializeField ]
9
10
private WebXRController leftController ;
11
+ [ SerializeField ]
10
12
private WebXRController rightController ;
11
13
12
14
private bool isFollowing = false ;
@@ -16,6 +18,29 @@ public class SceneHitTest : MonoBehaviour
16
18
17
19
private Transform arCameraTransform ;
18
20
21
+ void Start ( )
22
+ {
23
+ if ( leftController == null || rightController == null )
24
+ {
25
+ var controllers = FindObjectsOfType < WebXRController > ( ) ;
26
+ for ( int i = 0 ; i < controllers . Length ; i ++ )
27
+ {
28
+ if ( controllers [ i ] . hand == WebXRControllerHand . LEFT )
29
+ {
30
+ leftController ??= controllers [ i ] ;
31
+ }
32
+ else if ( controllers [ i ] . hand == WebXRControllerHand . RIGHT )
33
+ {
34
+ rightController ??= controllers [ i ] ;
35
+ }
36
+ if ( leftController != null && rightController != null )
37
+ {
38
+ return ;
39
+ }
40
+ }
41
+ }
42
+ }
43
+
19
44
void OnEnable ( )
20
45
{
21
46
isFollowing = false ;
You can’t perform that action at this time.
0 commit comments