Search Unity

[SteamVR] Camera Preview different from Game window

Discussion in 'AR/VR (XR) Discussion' started by Adam_Streck, Feb 24, 2020.

  1. Adam_Streck

    Adam_Streck

    Joined:
    Jul 31, 2013
    Posts:
    24
    I have noticed that the view displayed in "Game" window and " Camera Preview" window are considerably different. In particular the "Camera Preview" shows much bigger space (see attached file).

    I would like to display to the user what is shown in "Camera Preview".

    Also I can't convert from worldspace to user space - it seems like the "Game" view exist in the space between 0.2-0.8 of the "Camera Preview Space". I'm matching the Eye in the conversion but it still does not work. The following code:

    Code (CSharp):
    1. var cameraPos = Camera.main.WorldToScreenPoint(gazeBall.position, Camera.MonoOrStereoscopicEye.Left);
    2. var eyeTexDim = new Vector2(XRSettings.eyeTextureWidth, XRSettings.eyeTextureHeight);
    3. var cursorPos = new Vector2(cameraPos.x / eyeTexDim.x, cameraPos.y / eyeTexDim.y);
    Gives me cursorPos = (0.2,0.2) for top-left corner of the "Game" view set to "Left Eye".
     

    Attached Files:

unityunity