Skip to content

Commit 0fbeeb6

Browse files
committed
Added GetLocalRotation and GetLocalPosition + more cleaning for Camera matrices handling.
1 parent 75902b0 commit 0fbeeb6

File tree

12 files changed

+34
-12
lines changed

12 files changed

+34
-12
lines changed

Build/Build/Build.data.unityweb

73 Bytes
Binary file not shown.

Build/Build/Build.wasm

3.99 KB
Binary file not shown.

Build/Build/Build.wasm.framework.unityweb

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Build/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
document.dispatchEvent(new CustomEvent('toggleVR', {}));
5151
}, false);
5252
</script>
53-
<script src="gl-matrix-min.js"></script>
5453
<script src="webxr.js"></script>
5554
</body>
5655
</html>

Packages/webxr/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
- GetLocalRotation and GetLocalPosition to WebXRCamera.
10+
811
### Changed
912
- Using `frame.fillPoses` and `frame.fillJointRadii` instead of `frame.getJointPose` for XRHand.
1013
- Camera matrices handling.

Packages/webxr/Hidden~/WebGLTemplates/WebXR/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
document.dispatchEvent(new CustomEvent('toggleVR', {}));
5151
}, false);
5252
</script>
53-
<script src="gl-matrix-min.js"></script>
5453
<script src="webxr.js"></script>
5554
</body>
5655
</html>

Packages/webxr/Hidden~/WebGLTemplates/WebXR2020/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
document.dispatchEvent(new CustomEvent('toggleVR', {}));
9999
}, false);
100100
</script>
101-
<script src="gl-matrix-min.js"></script>
102101
<script src="webxr.js"></script>
103102
</body>
104103
</html>

Packages/webxr/Hidden~/WebGLTemplates/WebXRFullView/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
document.dispatchEvent(new CustomEvent('toggleVR', {}));
5252
}, false);
5353
</script>
54-
<script src="gl-matrix-min.js"></script>
5554
<script src="webxr.js"></script>
5655
</body>
5756
</html>

Packages/webxr/Hidden~/WebGLTemplates/WebXRFullView2020/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
document.dispatchEvent(new CustomEvent('toggleVR', {}));
9898
}, false);
9999
</script>
100-
<script src="gl-matrix-min.js"></script>
101100
<script src="webxr.js"></script>
102101
</body>
103102
</html>

Packages/webxr/Runtime/Scripts/WebXRCamera.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,34 @@ void Update()
6666
}
6767
}
6868

69+
public Quaternion GetLocalRotation()
70+
{
71+
switch (xrState)
72+
{
73+
case WebXRState.AR:
74+
return cameraARL.transform.localRotation;
75+
case WebXRState.VR:
76+
return cameraL.transform.localRotation;
77+
}
78+
return cameraMain.transform.localRotation;
79+
}
80+
81+
public Vector3 GetLocalPosition()
82+
{
83+
switch (xrState)
84+
{
85+
case WebXRState.AR:
86+
if (viewsCount > 1)
87+
{
88+
return (cameraARL.transform.localPosition + cameraARR.transform.localPosition) * 0.5f;
89+
}
90+
return cameraARL.transform.localPosition;
91+
case WebXRState.VR:
92+
return (cameraL.transform.localPosition + cameraR.transform.localPosition) * 0.5f;
93+
}
94+
return cameraMain.transform.localPosition;
95+
}
96+
6997
public Camera GetCamera(CameraID cameraID)
7098
{
7199
switch (cameraID)

0 commit comments

Comments
 (0)