如何跟踪实体上的 raycaster 交点坐标?
How to follow raycaster intersection coordinates on an entity?
我正在尝试使用 raycaster 在平面上绘图。
我知道当 raycaster 和平面相交时如何得到通知,但在那之后我不知道如何在 raycaster 穿过平面移动时获取交叉点的更新坐标。
AFRAME.registerComponent('raycaster-listen', {
init: function () {
this.raycaster = document.querySelector('#myRay');
},
tick: function () {
var intersection = this.raycaster.components.raycaster.getIntersection(this.el);
if (!intersection) { return; }
console.log(intersection);
}
});
<a-entity geometry material raycaster-listen></a-entity>
我正在尝试使用 raycaster 在平面上绘图。
我知道当 raycaster 和平面相交时如何得到通知,但在那之后我不知道如何在 raycaster 穿过平面移动时获取交叉点的更新坐标。
AFRAME.registerComponent('raycaster-listen', {
init: function () {
this.raycaster = document.querySelector('#myRay');
},
tick: function () {
var intersection = this.raycaster.components.raycaster.getIntersection(this.el);
if (!intersection) { return; }
console.log(intersection);
}
});
<a-entity geometry material raycaster-listen></a-entity>