강의

멘토링

커뮤니티

Inflearn Community Q&A

wosk01063371's profile image
wosk01063371

asked

3D interactive web starting with Three.js

Detecting Clicked Mesh

intersectObjects 오류

Written on

·

345

0

 

마우스 클릭 시 checkIntersects()를 호출하고

raycaster.intersectObject(meshes);

를 실행할 때 오류가 발생합니다.

 

오류가 나는 지점의 three.module.js 코드를 보면, 

아래의 조건문에서 object.layers.test 함수를 호출하는데,

이 때 test 함수를 찾지 못한다고 하네요.

if ( object.layers.test( raycaster.layers ) ) {

object.raycast( raycaster, intersects );

}

 

완성된 소스를 실행해도 동일합니다.

해결 방법이 있을까요?

 
blender인터랙티브-웹Three.js

Answer 1

0

같은 강의를 들었는데.. 저런 조건문을 쓴적이 있나요? 다시 봐도 안보이는뎅..

wosk0106님의 프로필 이미지
wosk0106
Questioner

저 조건문을 직접 작성하지는 않았지만, 해당 함수 내에서 three.module.js 의 Raycaster.intersectObject를 호출 하면서 오류가 발생하네요.

https://github.com/wealth99/three_js 제 깃허브에 소스 올려놨는데 보고 비교해보세요!

저도 하면서 보니까 raycaster.intersectObject => raycaster.intersectObjects 뒤에 s를 빠트리셨네요

wosk0106님의 프로필 이미지
wosk0106
Questioner

으.. 그러네요...저런 실수를...ㅠㅠ

감사합니다..!

wosk01063371's profile image
wosk01063371

asked

Ask a question