Aframe射线广播器未击中对象

时间:2018-07-18 23:03:19

标签: angular aframe raycasting gltf

我正在尝试在框架中向3d模型添加点击处理程序。模型中只有几个小区域会触发click事件。有人可以帮我弄清楚为什么射线投射仪大部分时间都没有击中物体吗?我在aframe场景中添加了Angular2模板的片段。我正在使用Aframe版本0.8.2。

<div
  #sceneContainer
  id="sceneContainer"
  oncontextmenu="return false;"
  (mousedown)="onMouseDown($event)"
  (touchstart)="onTouchStart($event)"
  (mousemove)="onMouseMove($event)"
  (touchmove)="onTouchMove($event)"
  [ngClass]="{invisible: !config['model']}"
  style="width: 100%; height:100%; cursor:pointer;">
  <a-scene id="scene" embedded vr-mode-ui="enabled: false" cursor="rayOrigin: mouse">
    <a-entity id="camera" camera></a-entity>
    <a-sky src="assets/sky.jpg" rotation="-20 0 0"></a-sky>
    <a-plane color="#CCC" height="2" width="2" position="0 -0.5 0" rotation="-90 0 0"></a-plane>
    <a-entity id="model" position="0 0 -1" (click)="modelClicked.emit($event)">
      <a-entity gltf-model="https://s3.us-east-1.amazonaws.com/me.seek-ar.media.staging/53a6ebba-995d-4a75-b017-c75986807beb/a7cdb785-fcc3-41c9-9c6a-0c21ebcb0e27.glb"></a-entity>
    </a-entity>
  </a-scene>
</div>

任何帮助将不胜感激!

更新:

我已找到问题的原因。参见aframe embeded scene with cursor mouse ray-origin

滚动或移动场景容器似乎并不更新光线投射器。有人对此有解决方法吗?

0 个答案:

没有答案