Skip to content
Snippets Groups Projects
Commit e43de780 authored by joni's avatar joni
Browse files

Merge branch 'media-tools-followup' of https://github.com/mozilla/hubs into media-tools-followup

parents b7374964 94b4c57a
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,7 @@ AFRAME.registerComponent("cursor-controller", { ...@@ -53,6 +53,7 @@ AFRAME.registerComponent("cursor-controller", {
tick: (() => { tick: (() => {
const rayObjectRotation = new THREE.Quaternion(); const rayObjectRotation = new THREE.Quaternion();
const cameraPos = new THREE.Vector3();
return function() { return function() {
if (!this.enabled) { if (!this.enabled) {
...@@ -97,6 +98,11 @@ AFRAME.registerComponent("cursor-controller", { ...@@ -97,6 +98,11 @@ AFRAME.registerComponent("cursor-controller", {
if (this.data.drawLine) { if (this.data.drawLine) {
this.el.setAttribute("line", { start: this.origin.clone(), end: this.data.cursor.object3D.position.clone() }); this.el.setAttribute("line", { start: this.origin.clone(), end: this.data.cursor.object3D.position.clone() });
} }
// The curser will always be oriented towards the player about its Y axis, so bjects held by the cursor will rotate towards the player.
this.data.camera.object3D.getWorldPosition(cameraPos);
cameraPos.y = this.data.cursor.object3D.position.y;
this.data.cursor.object3D.lookAt(cameraPos);
}; };
})(), })(),
......
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