0

我正在尝试将点击处理程序添加到 aframe 中的 3d 模型。模型中只有少数几个小区域会触发点击事件。有人可以帮我弄清楚为什么光线投射器大部分时间都没有击中物体吗?我在 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>

任何帮助,将不胜感激!

更新:

我找到了问题的原因。查看带有光标鼠标光线来源的帧嵌入场景

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

4

0 回答 0