diff --git a/src/components/cursor.js b/src/components/cursor.js index 0ac5f249bb0..6d5518e8f28 100644 --- a/src/components/cursor.js +++ b/src/components/cursor.js @@ -86,6 +86,7 @@ module.exports.Component = registerComponent('cursor', { update: function (oldData) { if (this.data.rayOrigin === oldData.rayOrigin) { return; } + if (this.data.rayOrigin === 'entity') { this.resetRaycaster(); } this.updateMouseEventListeners(); // Update the WebXR event listeners if needed if (this.data.rayOrigin === 'xrselect') { @@ -220,6 +221,13 @@ module.exports.Component = registerComponent('cursor', { this.updateCanvasBounds(); }, + resetRaycaster: function () { + this.el.setAttribute('raycaster', { + direction: new THREE.Vector3().set(0, 0, -1), + origin: new THREE.Vector3() + }); + }, + addWebXREventListeners: function () { var self = this; var xrSession = this.el.sceneEl.xrSession;