Search Unity

HolographicSettings SetFocusPointForFrame seems to make things worse [HOLOLENS]

Discussion in 'VR' started by Harrison_Perry, Jan 24, 2018.

  1. Harrison_Perry

    Harrison_Perry

    Joined:
    Jan 16, 2017
    Posts:
    9
    Hey all,

    I'm having issues with hologram stability.

    I've got an empty unity scene with a plane world anchored 2 metres from the camera.

    When SetFocusPointForFrame is not set, the plane is stable from a distance and fairly stable at arm's length.

    When SetFocusPointForFrame is set, the plane oscillates at arm's length (1m - 50cm range) and at a distance.

    The code is below. Please let me know if I am missing something, but it appears that setting a focus point makes things worse, not better.

    Unity version: 2017.3.0p3
    Windows SDK: 10.0.16299.0

    Many thanks,

    Harrison

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using HoloToolkit.Unity.InputModule;
    5. using HoloToolkit.Unity;
    6. using HoloToolkit.Unity.SpatialMapping;
    7. using HoloLensXboxController;
    8. using UnityEngine.XR.WSA.Input;
    9. using UnityEngine.XR.WSA;
    10. using UnityEngine.UI;
    11.  
    12. public class StabilisingTest : MonoBehaviour
    13. {
    14.  
    15.     // Use this for initialization
    16.  
    17.     public GameObject plane;
    18.  
    19.     GestureRecognizer gr;
    20.     GazeStabilizer gs;
    21.     Transform CamTran;
    22.     public Text Label;
    23.  
    24.     bool focusPointSet = false;
    25.  
    26.     void Start()
    27.     {
    28.  
    29.         CamTran = Camera.main.transform;
    30.  
    31.         gs = new GazeStabilizer();
    32.  
    33.         gr = new GestureRecognizer();
    34.         gr.SetRecognizableGestures(GestureSettings.Tap);
    35.         gr.StartCapturingGestures();
    36.         gr.Tapped += Gr_Tapped;
    37.  
    38.         plane.transform.position = CamTran.position + (CamTran.forward * 2f);
    39.         WorldAnchorManager.Instance.AttachAnchor(plane);
    40.         SpatialMappingManager.Instance.DrawVisualMeshes = false;
    41.         SpatialMappingManager.Instance.StopObserver();
    42.  
    43.     }
    44.  
    45.     //https://docs.unity3d.com/550/Documentation/ScriptReference/VR.WSA.HolographicSettings.SetFocusPointForFrame.html
    46.     void Update()
    47.     {
    48.         TappedEventArgs x = new TappedEventArgs();
    49.  
    50.         if (Input.GetKeyDown(KeyCode.T))
    51.             Gr_Tapped(x);
    52.      
    53.  
    54.         var normal = -Camera.main.transform.forward;     // Normally the normal is best set to be the opposite of the main camera's forward vector
    55.                                                          // If the content is actually all on a plane (like text), set the normal to the normal of the plane
    56.                                                          // and ensure the user does not pass through the plane
    57.         var position = plane.transform.position;
    58.  
    59.         if(focusPointSet)
    60.         {
    61.             HolographicSettings.SetFocusPointForFrame(position, normal);
    62.         }
    63.    
    64.      
    65.     }
    66.  
    67.     private void Gr_Tapped(TappedEventArgs obj)
    68.     {
    69.         if (!focusPointSet)
    70.         {
    71.             Label.text = "Focus point set!";
    72.             focusPointSet = true;
    73.          
    74.         }
    75.         else
    76.         {
    77.  
    78.             Label.text = "Focus point not set!";
    79.             focusPointSet = false;
    80.  
    81.         }
    82.  
    83.  
    84.  
    85.  
    86.  
    87.  
    88.     }
    89. }
    90.  
     
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    There is a bug currently with the focus frame which sounds similar to what you are seeing, can you send a screen shot?
     
  3. Harrison_Perry

    Harrison_Perry

    Joined:
    Jan 16, 2017
    Posts:
    9
    Sorry, should have replied sooner. Have confirmed this is the same bug. Been told a fix is in the pipeline. Cheers!
     
  4. marcovenuti1969

    marcovenuti1969

    Joined:
    Jul 1, 2013
    Posts:
    1
    Hi,
    I'm having the same issue with hologram stability plane (using Unity 2017.3.0f3).
    What version of Unity should I use which is not affected by this issue?
     
  5. jghospital

    jghospital

    Joined:
    Nov 22, 2017
    Posts:
    17
    2017.2.0f3 should work for you, although it has some other bugs that could affect your project.