diff --git a/src/components/pitch-yaw-rotator.js b/src/components/pitch-yaw-rotator.js index bc1bd4f7876789f87eaa6d5e638d3efa3b3e0af4..bb7eb4c56d2ec9a21fb58d72deda5be1402c35a3 100644 --- a/src/components/pitch-yaw-rotator.js +++ b/src/components/pitch-yaw-rotator.js @@ -15,12 +15,13 @@ AFRAME.registerComponent("pitch-yaw-rotator", { look(deltaPitch, deltaYaw) { const { minPitch, maxPitch } = this.data; this.pitch += deltaPitch; - this.pitch = Math.max(minPitch, Math.min(maxPitch, this.pitch)); + this.pitch = THREE.Math.clamp(this.pitch, minPitch, maxPitch); this.yaw += deltaYaw; }, set(pitch, yaw) { - this.pitch = radToDeg(pitch); + const { minPitch, maxPitch } = this.data; + this.pitch = THREE.Math.clamp(radToDeg(pitch), minPitch, maxPitch); this.yaw = radToDeg(yaw); }, diff --git a/src/hub.js b/src/hub.js index a9033ebfed74a1222864f41ac1af6c7033bf662c..27e2ea303ea07ebe55500be5beee911541577829 100644 --- a/src/hub.js +++ b/src/hub.js @@ -181,6 +181,7 @@ function setupLobbyCamera() { if (previewCamera) { camera.object3D.position.copy(previewCamera.position); camera.object3D.rotation.copy(previewCamera.rotation); + camera.object3D.rotation.reorder("YXZ"); camera.object3D.updateMatrix(); } else { const cameraPos = camera.object3D.position; @@ -188,7 +189,7 @@ function setupLobbyCamera() { } camera.setAttribute("scene-preview-camera", "positionOnly: true; duration: 60"); - camera.components["pitch-yaw-rotator"].set(camera.object3D.rotation.x / 2, camera.object3D.rotation.y); + camera.components["pitch-yaw-rotator"].set(camera.object3D.rotation.x, camera.object3D.rotation.y); } let uiProps = {};