From 5a20ddaffa3535091299c2d5fb3e1ecb1c30a6d0 Mon Sep 17 00:00:00 2001 From: Kyle Baker Date: Tue, 29 Dec 2020 14:28:16 -0500 Subject: [PATCH 1/2] handle update on rayOrigin from mouse -> entity fixes issue https://github.com/aframevr/aframe/issues/4759 --- src/components/cursor.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/cursor.js b/src/components/cursor.js index 67c9b5ebd72..9666249fb5c 100644 --- a/src/components/cursor.js +++ b/src/components/cursor.js @@ -83,6 +83,7 @@ module.exports.Component = registerComponent('cursor', { update: function (oldData) { if (this.data.rayOrigin === oldData.rayOrigin) { return; } + if (this.data.rayOrigin === "entity") { this.updateOriginAndDirection(); } this.updateMouseEventListeners(); }, @@ -193,6 +194,16 @@ module.exports.Component = registerComponent('cursor', { this.updateCanvasBounds(); }, + updateOriginAndDirection: function () { + var rayCasterConfig = { + direction: new THREE.Vector3(), + origin: new THREE.Vector3(), + }; + rayCasterConfig.direction.set(0,0,-1); + rayCasterConfig.origin.set(0,0,0); + this.el.setAttribute('raycaster', rayCasterConfig); + }, + onMouseMove: (function () { var direction = new THREE.Vector3(); var mouse = new THREE.Vector2(); From b0f07445b48153146b146b342db0b069ea4dda0f Mon Sep 17 00:00:00 2001 From: Diego Marcos Date: Fri, 22 Nov 2024 16:26:31 -0800 Subject: [PATCH 2/2] remove space --- src/components/cursor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/cursor.js b/src/components/cursor.js index 1cc230445cf..6d5518e8f28 100644 --- a/src/components/cursor.js +++ b/src/components/cursor.js @@ -227,7 +227,7 @@ module.exports.Component = registerComponent('cursor', { origin: new THREE.Vector3() }); }, - + addWebXREventListeners: function () { var self = this; var xrSession = this.el.sceneEl.xrSession;