Skip to content

Commit 832d6ab

Browse files
authored
Merge pull request #46 from De-Panther/hololens2_inputsources_fix
Try to fix an inputSources bug when runs in Firefox Reality for Hololens 2
2 parents 44af85f + c10e16e commit 832d6ab

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Assets/WebGLTemplates/WebXR/webxr.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@
255255

256256
XRManager.prototype.getXRGamepads = function(frame, inputSources, refSpace) {
257257
var vrGamepads = []
258-
for (let inputSource of inputSources) {
258+
if (!inputSources || !inputSources.length) {
259+
return vrGamepads;
260+
}
261+
for (var i = 0; i < inputSources.length; i++) {
262+
let inputSource = inputSources[i];
259263
// Show the input source if it has a grip space
260264
if (inputSource.gripSpace && inputSource.gamepad) {
261265
let inputPose = frame.getPose(inputSource.gripSpace, refSpace);

Assets/WebGLTemplates/WebXRFullView/webxr.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@
255255

256256
XRManager.prototype.getXRGamepads = function(frame, inputSources, refSpace) {
257257
var vrGamepads = []
258-
for (let inputSource of inputSources) {
258+
if (!inputSources || !inputSources.length) {
259+
return vrGamepads;
260+
}
261+
for (var i = 0; i < inputSources.length; i++) {
262+
let inputSource = inputSources[i];
259263
// Show the input source if it has a grip space
260264
if (inputSource.gripSpace && inputSource.gamepad) {
261265
let inputPose = frame.getPose(inputSource.gripSpace, refSpace);

Build/webxr.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@
255255

256256
XRManager.prototype.getXRGamepads = function(frame, inputSources, refSpace) {
257257
var vrGamepads = []
258-
for (let inputSource of inputSources) {
258+
if (!inputSources || !inputSources.length) {
259+
return vrGamepads;
260+
}
261+
for (var i = 0; i < inputSources.length; i++) {
262+
let inputSource = inputSources[i];
259263
// Show the input source if it has a grip space
260264
if (inputSource.gripSpace && inputSource.gamepad) {
261265
let inputPose = frame.getPose(inputSource.gripSpace, refSpace);

0 commit comments

Comments
 (0)