2017-03-23 1 views
0

나는 raycaster로 작업하려고하지만, 작동하지 않습니다 (내 콘솔에는 아무것도 표시되지 않습니다).aframe raycaster가 브라우저에 등록되지 않았습니다.

<a-scene> 
<a-entity id="player" collider-check> 
    <a-entity raycaster="objects: .collidable" position="0 -0.9 0" rotation="90 0 0"></a-entity> 
</a-entity> 
<a-entity class="collidable" geometry="primitive: box" position="1 0 0"></a-entity> 
</a-scene> 

내가 알 수 방향으로 도보로 시도하고 아무것도 내 콘솔에 표시되지 않습니다 index.html을

AFRAME.registerComponent('collider-check', { 
dependencies: ['raycaster'], 
init: function() { 
     this.el.addEventListener('raycaster-intersected', function() { 
    console.log('Player hit something!'); 
    }); 
    } 
}); 

파일 https://aframe.io/docs/0.5.0/components/raycaster.html

자바 스크립트 : 나는의 예를 시도했다. xampp 서버의 Google 크롬에서 코드를 실행합니다.

누군가가 나에게 무슨 일이 일어 났는지 설명 할 수 있기를 바랍니다.

+0

콘솔에 경고가 있습니까? 순서대로 물건을 포함 했습니까? (A 프레임 JS, 컴포넌트 JS, 그 다음 ). – ngokevin

+0

미안하지만 따라 할 수 없지만 component.js가 무엇인지 지정할 수 있습니까? 내가 그립 었니 ??? – user3464409

+0

귀하의 JS 붙여 넣기 – ngokevin

답변

0

이 구조를 사용해보십시오. 구성 요소가 A 프레임 HTML 앞에 등록되어 있는지 확인하십시오.

<html> 
    <head> 
    <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> 
    <script src="collider-check.js"></script> 
    </head> 
    <body> 
    <a-scene> 
     <a-entity collider-check></a-entity> 
    </a-scene> 
    </body> 
</html> 
+0

이 날짜까지이 질문은 답변이되지 않습니다. Aframe 문서의 예제가 작동하지 않는 것 같습니다. – user3464409

관련 문제