【问题标题】:How to follow raycaster intersection coordinates on an entity?如何跟踪实体上的光线投射相交坐标?
【发布时间】:2019-02-14 20:02:59
【问题描述】:

我正在尝试使用光线投射器在飞机上绘图。

我知道如何在光线投射器和飞机相交时收到通知,但之后我不知道如何在光线投射器在飞机上移动时获取交叉点的更新坐标。

【问题讨论】:

    标签: aframe virtual-reality


    【解决方案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>
    

    【讨论】:

    • 我现在会为此更新文档,只是意识到没有记录
    • i' 收到此错误:“SCRIPT438:SCRIPT438:对象不支持属性或方法 'getIntersection'”我的光线投射器是这样的:
    • 糟糕,我是raycaster.components.raycaster.getIntersection
    猜你喜欢
    • 2011-08-29
    • 2021-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多