Skip to content

Commit

Permalink
Change order of rotation to yaw and then pitch
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hasandogu committed Oct 3, 2017
1 parent 5ea4ba0 commit 65f785f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/embed/hotspot-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 65f785f

Please sign in to comment.