Ray intersection and child camera

Posted by lutangar on Stack Overflow See other posts from Stack Overflow or by lutangar
Published on 2012-12-14T08:58:20Z Indexed on 2012/12/15 11:04 UTC
Read the original article Hit count: 226

Filed under:
|
|
|

I've been playing with three.js for few weeks now and got few inconsistencies on ray casting. Here is a simplified version demonstrating one of the bug I encoutered :

http://jsfiddle.net/eMrhb/12/

The camera is added to the sphere mesh for further use of TrackBallControl for example.

scene.add(mesh);    
mesh.add(camera);

Clicking a few times on the sphere and opening the console, show us none of the expected intersections between the ray and the mesh.

Adding the camera to the scene (http://jsfiddle.net/eMrhb/9/), solves the problem:

scene.add(mesh);    
scene.add(camera);

But I could use a much more complex hierarchy between my scene objects and the camera to suit my needs.

Is this a limitation? If it is, is there any workarounds I could use?

© Stack Overflow or respective owner

Related posts about camera

Related posts about three.js