Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How Can I track Where Player Looks At?

Discussion in 'AR/VR (XR) Discussion' started by stormwindy, Jan 28, 2019.

  1. stormwindy

    stormwindy

    Joined:
    Jan 20, 2019
    Posts:
    1
    Hey there,

    I am looking for ways to collect raw data of where people look at in the map. How can I do this? I am looking for possible libraries but also want to know how I can do it. Moreover, I want to work on raw data using ML. I am very new to Unity.

    Thank you.

    EDIT1: I am aware a tool exists in Unity Analytic Heatmap for this purpose. However, I am not subscribed to Unity pro. I am not advanced enough to invest in it yet.
     
  2. SimRuJ

    SimRuJ

    Joined:
    Apr 7, 2016
    Posts:
    247
    In non-vr you'd use:
    Code (CSharp):
    1. Vector3 v = transform.forward
    to get a Vector3 of the direction the camera is facing. Documentation: click

    For VR use (documentation: click):
    Code (CSharp):
    1. Quaternion v = UnityEngine.XR.InputTracking.GetLocalRotation(XRNode.Head);
    This returns a quaternion of the rotation of the user's head.