Three.js - Stereo Effect - Picking - three.js

I had the possibility to test the Stereo Effect on a TV using side by side images. It works fine.
The only problem is when I want to pick something : the picked point is wrong.
To debug I draw the line eye-picked_point.
I picked a point in 3D mode (with the glasses and the TV in 3D mode).
Then I stopped the TV 3D mode to see the 2 three.js images with the lines eye-picked_point.
Here is the result : the picked point is not in the blue face :
Maybe it is important to say that the html page is like this :
- First there is a line to write debug informations.
- Under this line there is a line of buttons.
- Under the buttons there is the three.js view.
The picking works well in normal mode.
Should the picking work in 3D ?
Does it work for you ?

To answer : it is not possible to pick in 3D using the mouse pointer because the mouse pointer is a 2D thing over the 2 side by side images. It is not something that is seen in 3D.

Related

Misplaced UI made with UI in hololens emulator

I got a small problem and I can’t really find the source of it. I just created a Canvas and put a Panel in the top right corner. I got it to the right scale at 3: for the Hololens and loaded it up in the Holoemulator. The problem is that even though the panel is supposed to be in the corner, it is placed almost in the middle of the screen in the end.
Is there anything I can do to fix this or is there something I am missing?
If I need to provide more information then please tell me.
Could you double-check the [Render mode] of your Canvas? Is it set as World Space? In this render mode, the Canvas will behave as any other 3D object and will render in front of or behind other objects in the scene based on 3D placement in the scene. You need to adjust the position of the canvas from the perspective of the camera.
However, according to your post, it seems that you want to place UI elements on the screen rendered on top of the scene. If so, You should turn the [Render mode] to [Screen Space - Camera]. More information please see: Canvas

How to fix Blue Screen appearing after GameObject is removed in Unity 2d Project

I have been successfully building and running a Unity 2D game, but started receiving a Blue Screen during one of my operations. Specifically, when I close a popup and remove all of its child Game Objects, the entire Game Screen turns dark blue (the default background color of the main camera). The music for the game still plays and clicks are still registered if you click in the right area (I can still press the back button, just can't see it).
If I remove 1 gameobject, this problem doesn't come up. But once I have to remove 2 game objects, the entire screen turns blue.
This is my function for removing my game object in case it helps, which works perfectly when it comes to actually removing the gameObjects correctly (game objects to be removed are created from prefabs). I think the problem may be with the camera for some reason, but I have no clue as to why it happens on this function.
public void Remove(int index)
{
float toggleWidth = toggle.GetComponent<RectTransform>().sizeDelta.x;
DestroyImmediate(scrollSnap.pagination.transform.GetChild(scrollSnap.NumberOfPanels - 1).gameObject);
scrollSnap.Remove(index);
scrollSnap.pagination.transform.position += new Vector3(toggleWidth / 2f, 0, 0);
}
I don't receive any errors or warnings in the console. Just a blue screen once more than one GameObject is removed
EDIT:
Turns out my main Canvas's planeDistance was being changed from 100 to 3200. I still have no clue as to why this change occurred...but for anyone else having a similar issue with a dark blue screen appearing in the middle or start of their game, then please check the values your canvas and camera in the Inspector. Simply controlling the planeDistance did the trick for me!
Made a new scene next to the sample scene when i started my sprite learning game. Forgot all about that.
When I had to publish it, In the Build Settings, I had the wrong scene selected. So It published an empty scene instead of my game.
I solved it by putting game in 3d mode and realized that the camera is positioned very far from the sprites, just change the z-axis and again go to 2d mode.
Just Move your camera in Z-axis position, it could be too far from object or it is behind the object, you can also check it by 3D mode the check the object position and change it in positive and negative values.

HoloLens - UI/Slider and Cursor do not intersect during gaze

I'm trying to use UI/Slider in Unity app for HoloLens.
I used the steps described here - Unity UI on the HoloLens
So as a result I have following structure:
MainCamera properties:
SliderCanvas is using MainCamera:
Slider properties:
InteractiveMeshCursor is taken from HoloToolkit.
As a result I'm getting this picture:
When I move the head the Cursor behaves correctly - it stays in the middle of the scene. If I add other 3D objects on the Scene it also correctly changes its states so GazeManager looks like is working correctly.
However I cannot gaze at Slider because it moves with the Camera too and stays in the bottom/center of the scene where I want it to be. So in my case there is no way for them to intersect.
How can I fix this? Do I need to add an other Camera for the SliderCanvas but then how to control both cameras? I am definitely missing something and would appreciate your help.
As expected the solution turned out to be simple (I missed one step from the tutorial). For UI objects you need to set Render Mode property for the Canvas to World Space and changed the Position and Scale of the Slider. Now the Gaze is working.
SliderCanvas properties:
Slider properties:

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 : http://i.imgur.com/FzbHV2U.png. Also, the code from the stereo effect comes from : http://threejs.org/examples/js/effects/StereoEffect.js
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.

Not able to run unity 3d app properly

I have just started to learn Unity 3D. I am using this as first lesson. I created a terrain, added texture, plants and grasses, added first person controller and directional lighting. When I press play, the scene automatically starts moving along Y direction. I want the scene to move only when i give input using keyboard or mouse. How to achieve this ?
The first person controller has to be placed above the terrain completely. After doing this I get the desired effect.

Resources