2016-06-02 6 views
1
<a-assets> 
     <a-mixin id="ring" geometry="primitive: ring; radiusOuter: 0.20; 
       radiusInner: 0.15;" 
       material="color: cyan; shader: flat" 
       cursor=" fuse: true"></a-mixin> 
     <a-asset-item id="mancloth" src="../models/man.obj"></a-asset-item> 
     <a-asset-item id="manclothmtl" src="../models/man.mtl"></a-asset-item> 
</a-assets> 
<a-entity camera look-controls wasd-controls><a-entity mixin="ring" position="0 0 -3"> 
     <a-animation begin="cursor-click" easing="ease-in" attribute="scale" 
       fill="backwards" from="0.3 0.3 0.3" to="1 1 1"></a-animation> 
     <a-animation begin="cursor-fusing" easing="ease-in" attribute="scale" 
       fill="forwards" from="1 1 1" to="0.3 0.3 0.3"></a-animation> 
     </a-entity> 
</a-entity> 
<a-obj-model scale="1 1 1" src="#mancloth" mtl="#manclothmtl"></a-obj-model> 

카메라를 사용하여 obj와 상호 작용하지만 aframe.js는 57766 줄에 오류를 표시합니다. aframe.js를 변경하지 않고이 문제를 해결하려면 어떻게해야합니까?AFrame에서 obj 또는 collada-model과 상호 작용하는 방법

var intersectedEl = intersection.object.el; 
intersectedEl.emit('raycaster-intersected', {el: el,intersection:intersection}); 

intersection.object는 THREE.Mesh, 그래서 intersection.object.el는 정의되지 않습니다!

답변

1

이 문제는 모델의 각 하위에 A- 프레임 엔터티를 바인딩하여 https://github.com/aframevr/aframe/pull/1497에서 수정되었습니다.

A- 프레임 0.3.0까지 기다리거나 최신 A- 프레임 마스터를 사용할 수 있습니다. 현재, 커서는 어떤 객체가 교차되었는지보기 위해 레이 캐스터를 사용합니다. OBJ/COLLADA 모델을 사용하면 객체 트리를 생성합니다. 그러나 A-Frame은 최상위 개체를 엔터티로 취급하고있었습니다. 따라서 레이 캐스터가 객체를 반환 할 때 이벤트를 발생시키는 관련 엔티티가 없었습니다. 이제

그냥 작동합니다 :

<a-camera><a-cursor></a-cursor></a-camera> 
<a-obj-model></a-obj-model>