Skip to content
Snippets Groups Projects
Unverified Commit a3359449 authored by Greg Fodor's avatar Greg Fodor Committed by GitHub
Browse files

Merge pull request #601 from mozilla/bug/preview-rotation-order

Fix rotation order discrepancy
parents f7d18c65 337fc967
No related branches found
No related tags found
No related merge requests found
...@@ -15,12 +15,13 @@ AFRAME.registerComponent("pitch-yaw-rotator", { ...@@ -15,12 +15,13 @@ AFRAME.registerComponent("pitch-yaw-rotator", {
look(deltaPitch, deltaYaw) { look(deltaPitch, deltaYaw) {
const { minPitch, maxPitch } = this.data; const { minPitch, maxPitch } = this.data;
this.pitch += deltaPitch; 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; this.yaw += deltaYaw;
}, },
set(pitch, yaw) { 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); this.yaw = radToDeg(yaw);
}, },
......
...@@ -181,6 +181,7 @@ function setupLobbyCamera() { ...@@ -181,6 +181,7 @@ function setupLobbyCamera() {
if (previewCamera) { if (previewCamera) {
camera.object3D.position.copy(previewCamera.position); camera.object3D.position.copy(previewCamera.position);
camera.object3D.rotation.copy(previewCamera.rotation); camera.object3D.rotation.copy(previewCamera.rotation);
camera.object3D.rotation.reorder("YXZ");
camera.object3D.updateMatrix(); camera.object3D.updateMatrix();
} else { } else {
const cameraPos = camera.object3D.position; const cameraPos = camera.object3D.position;
...@@ -188,7 +189,7 @@ function setupLobbyCamera() { ...@@ -188,7 +189,7 @@ function setupLobbyCamera() {
} }
camera.setAttribute("scene-preview-camera", "positionOnly: true; duration: 60"); 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 = {}; let uiProps = {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment