Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Help with VR gaze system

Discussion in 'AR' started by clebertavares, Nov 19, 2019.

  1. clebertavares

    clebertavares

    Joined:
    Jan 2, 2012
    Posts:
    55
    Hello,

    I started to make a simple VR gaze system from scratch, using Unity ARFoundation. First thing was to draw a line from my point of view to "infinity", like a pointer. I have this script running on my AR Session Origin at Update:

    Code (CSharp):
    1.            
    2.             myLine.SetPosition(0, transform.position);
    3.             myLine.SetPosition(1, transform.position+(transform.forward*1000));
    4.  
    This works on editor, I have a line, and I can turn and move my session origin (my "head" with camera), it follows up.

    But, when I use it on mobile... the line keeps still, doesnt turn and move with the device.

    What´s wrong?
     
  2. clebertavares

    clebertavares

    Joined:
    Jan 2, 2012
    Posts:
    55
    Oh well... nevermind. I solve it. I needed a reference to the arCameraManager, it holds the head-tracking information.


    Code (CSharp):
    1.  
    2.     myLine.SetPosition(0, arCameraManager.transform.position);
    3.     myLine.SetPosition(1, arCameraManager.transform.position+arCameraManager.transform.forward*100));
    4.  
    o/