From 65f785f0e5c8c845111772e90e3b18e5b158e114 Mon Sep 17 00:00:00 2001 From: Hasan Dogu Taskiran Date: Mon, 2 Oct 2017 20:07:12 -0700 Subject: [PATCH] Change order of rotation to yaw and then pitch THREE is using local axis to rotate using Euler and the order is 'XYZ' by default. Before this change, it would rotate around X first for "pitch" which would make local Y is than world Y, once it rotates around local "Y" for yaw the hotspot would end up being in the wrong place. This is not visible in the hotspots example as no pitch is set on any of the hotspots. --- src/embed/hotspot-renderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/embed/hotspot-renderer.js b/src/embed/hotspot-renderer.js index f6f9994f..507f3fd2 100644 --- a/src/embed/hotspot-renderer.js +++ b/src/embed/hotspot-renderer.js @@ -105,7 +105,7 @@ HotspotRenderer.prototype.add = function(pitch, yaw, radius, distance, id) { // Position the hotspot based on the pitch and yaw specified. var quat = new THREE.Quaternion(); - quat.setFromEuler(new THREE.Euler(THREE.Math.degToRad(pitch), THREE.Math.degToRad(yaw), 0)); + quat.setFromEuler(new THREE.Euler(THREE.Math.degToRad(pitch), THREE.Math.degToRad(yaw), 0, 'YXZ')); hotspot.position.applyQuaternion(quat); hotspot.lookAt(new THREE.Vector3());