Codebricks
Codebricks

Reputation: 1263

Using ThreeJS StereoEffect and Raycaster

Has anybody used ThreeJS StereoEffect and Raycaster together for collision detection (in stereo view). In standard full screen view I can easily check if a Vector2 in the middle of the screen colides with an object in my scene. When I switch on the stereo effect I in effect get 2 scenes, and the collision detection stops working, but I am not really sure how to proceed. Should I create two new vector2d objects, one for each view - help :) ...

Upvotes: 2

Views: 286

Answers (2)

Andrej
Andrej

Reputation: 707

You can use my StereoEffect.js file in your project for resolving problem. See example of using.

Upvotes: 0

Manu
Manu

Reputation: 36

It's a bit late, but ...

I encountered a similar problem, I eventually found the reason. Actually in StereoEffect THREE.js displays the meshes on the two eyes, but in reality is actually adds only one mesh to the scene, exactly in the middle of the line left-eye-mesh <-> right-eye-mesh, hidden to the viewer.

So when you use the raycaster, you need to use it on the real mesh on the middle, not the illusion displayed on each eye !

I detailled here how to do it Three.js StereoEffect displays meshes across 2 eyes

Hopes it solves your problem !

Upvotes: 1

Related Questions