From 9cda53c99c241c7d723e0eadf3d28acbd4c08746 Mon Sep 17 00:00:00 2001 From: MK Date: Wed, 18 Dec 2019 13:00:34 +0100 Subject: [PATCH] Use THREE.DeviceOrientationControls when webvrpolyfill is not used --- src/components/look-controls.js | 2 +- src/lib/three.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/look-controls.js b/src/components/look-controls.js index 4ae3a1c8cb5..83a9056584b 100644 --- a/src/components/look-controls.js +++ b/src/components/look-controls.js @@ -31,7 +31,7 @@ module.exports.Component = registerComponent('look-controls', { this.savedRotation = new THREE.Vector3(); this.savedPosition = new THREE.Vector3(); this.polyfillObject = new THREE.Object3D(); - this.polyfillControls = new PolyfillControls(this.polyfillObject); + this.polyfillControls = window.webvrpolyfill ? new PolyfillControls(this.polyfillObject) : new THREE.DeviceOrientationControls(this.polyfillObject); this.rotation = {}; this.deltaRotation = {}; this.savedPose = null; diff --git a/src/lib/three.js b/src/lib/three.js index b826044dd8c..e99f1b916ea 100644 --- a/src/lib/three.js +++ b/src/lib/three.js @@ -18,6 +18,8 @@ if (THREE.Cache) { THREE.Cache.enabled = true; } +require('super-three/examples/js/controls/DeviceOrientationControls'); // THREE.DeviceOrientationControls + // TODO: Eventually include these only if they are needed by a component. require('super-three/examples/js/loaders/DRACOLoader'); // THREE.DRACOLoader require('super-three/examples/js/loaders/GLTFLoader'); // THREE.GLTFLoader