EverydayLearner
EverydayLearner

Reputation: 302

Stereo effect and event listener in threejs

I'm trying to make a VR with three.js. Right now, all the 3D objects are showing up in my scene with a stereo effect, but I can't seem to get the event to launch properly when I click on an object of my scene. It seems that the stereo effect is on top of the regular camera and that I'm clicking on the real scene and not the one shown in the stereo effect. Is there a way that I can add an event listener to the object on each camera of the stereo effect? For example, when I click on an image on one side of the stereo effect, the event will be launched.

If it isn't possible, is there a way to see what the center of the camera is looking at. For example , if I'm looking at an image it will call the event associated to this image (for example, it will grow)? I read that this can be achieved with RayCasting but I don't know how to set the ray to the middle of the camera.

Thank you very much!

Edit : This is my current scene with the stereo effect : https://i.sstatic.net/tiZ4I.png. Also, the code from the stereo effect comes from : http://threejs.org/examples/js/effects/StereoEffect.js

Upvotes: 0

Views: 1932

Answers (1)

Renaud Vincent
Renaud Vincent

Reputation: 71

There are game extensions available for Three.js grouped in a library called THREEx. You should take a look at threex.domevents which adds typical Dom events to elements in the canvas.

Upvotes: 1

Related Questions