Home Forums Unity SDK Getting XYZ position in Unity

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #20082
    Yotam Hagur-Bahat
    Participant

    Hello, I am using the HTC VIVE PRO EYE and I want to record the X,Y,Z position of the gaze.
    Where can I find this function? I built a simple scene according to the tutorial and it works. I have in the scene the TobiiXR Initializer and I put on the object the ‘Highlight At Gaze’ script. But I can’t find where TOBII calculate the X, Y, Z position so I can take it from there.

    #20086
    Grant [Tobii]
    Keymaster

    Hi @yotam, within the Tobii XR SDK we provide the gaze origin and direction. From that, one can calculate a vector from the simple formula ‘gaze.origin + gaze.direction * length’. With this you can use a raycast in Unity to determine if that ray intersects with any objects in your scene and that will get you the the (x, y, z) of the intersection point. Info on Raycast @ https://docs.unity3d.com/ScriptReference/Physics.Raycast.html

    Hopefully, this is the information you are looking for! Let us know how it goes, best wishes.

    #20096
    Yotam Hagur-Bahat
    Participant

    Hi Grant,

    Thnx for the quick reply.
    I tried to look for the gaze.origin and gaze.direction but it seems that these two functions are not recognized.
    I created a new script, added ‘using TOBII.XR’ but the function are not recognized. I tried to put the script under ‘TOBIIXR’ directory, but still UNITY doesn’t recognize the function. What am I doing wrong ?

    Cheers
    Yotam

    #20097
    Grant [Tobii]
    Keymaster

    Hi @yotam, we have created a detailed walkthrough and tutorial with appropriate code included which demonstrates using the gaze ray which you can find @
    https://vr.tobii.com/sdk/develop/unity/unity-examples/object-mapping/

    This should hopefully show you exactly what you need to do. Please go through this and let us know how you get on. Best Wishes.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.