如何在实体上跟踪raycaster交叉点坐标?

问题描述 投票:0回答:1

我正试图用raycaster在飞机上画画。

我知道如何在raycaster和飞机相交时得到通知,但在此之后我不知道如何获得更新的交叉路口坐标,同时raycaster在飞机上移动。

aframe virtual-reality
1个回答
1
投票
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>
© www.soinside.com 2019 - 2024. All rights reserved.