Home Forums XR Discussions Gaze Ray visualisation in Unity from Vive Pro Eye Reply To: Gaze Ray visualisation in Unity from Vive Pro Eye

Grant [Tobii]

Hi @/schi990, thank your for your request. One very simple way to visualize avatar gaze in Unity is to use a Line Renderer using 2 points. The first point would be the origin of the gaze data (p1 = GazeRay.Origin) and the other would be a point along the gaze direction (p2 = GazeRay.Origin + GazeRay.Direction * distance).

One way to improve upon this is to make the second point dynamic and adjust its distance if any objects along the gaze direction are intercepted (you can raycast and if something is intercepted, adjust to that distance, otherwise set an arbritary distance such as 10 meters).

Another improvement could be to set a static point for the origin of the gaze ray visualization (p1). If you don’t do this, the gaze visualization origin will move with the GazeRay.Origin signal (it adjusts to be as accurate as possible, but in the case of avatar gaze visualization you might want to optimize for it looking good and steady instead of eye tracking data optimization).

Please try this out and let us know how you get on. Best Wishes.