桌面版移动鼠标时出错 (cursor.js)
Desktop version getting error while moving mouse (cursor.js)
我正在使用我们的 VR 体验版本(此处的回购:https://github.com/EFForg/spot_the_surveillance)并制作一个纯桌面版本以供演示。
我添加了 cursor="rayOrigin: mouse" 并将一些 mouseenter 事件更改为 click 事件。一切正常,除了当我将鼠标悬停在场景上时,我反复收到此错误:“Uncaught TypeError:t is null”,它指的是 cursor.js.
中的以下代码
// Ignore events further away than active intersection.
if (this.intersectedEl) {
currentIntersection = this.el.components.raycaster.getIntersection(this.intersectedEl);
if (currentIntersection.distance <= intersection.distance) { return; }
}
如何解决此错误?它会导致体验显着滞后。
谢谢!
查看从此页面链接的鼠标单击示例是一个很好的起点:https://aframe.io/docs/1.0.0/components/cursor.html#intersection-data
不幸的是,该示例使用的是 aframe 0.7.0,因此我不得不通读 1.0.4 的动画文档并进行相应调整:https://aframe.io/docs/1.0.0/components/animation.html
我还必须更新我使用的 aframe-event-set-component.js 的版本。
在这两个信息来源和版本更新之间,我能够让事情正常进行。
我正在使用我们的 VR 体验版本(此处的回购:https://github.com/EFForg/spot_the_surveillance)并制作一个纯桌面版本以供演示。
我添加了 cursor="rayOrigin: mouse" 并将一些 mouseenter 事件更改为 click 事件。一切正常,除了当我将鼠标悬停在场景上时,我反复收到此错误:“Uncaught TypeError:t is null”,它指的是 cursor.js.
中的以下代码// Ignore events further away than active intersection.
if (this.intersectedEl) {
currentIntersection = this.el.components.raycaster.getIntersection(this.intersectedEl);
if (currentIntersection.distance <= intersection.distance) { return; }
}
如何解决此错误?它会导致体验显着滞后。
谢谢!
查看从此页面链接的鼠标单击示例是一个很好的起点:https://aframe.io/docs/1.0.0/components/cursor.html#intersection-data
不幸的是,该示例使用的是 aframe 0.7.0,因此我不得不通读 1.0.4 的动画文档并进行相应调整:https://aframe.io/docs/1.0.0/components/animation.html
我还必须更新我使用的 aframe-event-set-component.js 的版本。
在这两个信息来源和版本更新之间,我能够让事情正常进行。