Designing and developing HUD/UI



  • Avatar
    Sam Collins

    World space Canvas is a good approach, but you could also use sprites or 3d objects as triggers depending on your needs.

    The most direct way to implement a gaze-based trigger would be to perform raycasts on each frame from the eye positions in the direction they're looking. I know there's an interface for getting gaze convergence out of the SDK, but I'm not sure it's stable yet. You can use this to control a cursor, such as a simple dot with a rigidbody attached to trigger collisions on other colliders. On the buttons, add a Box Collider component and a custom script to trigger an event on a collision with the cursor. 

    Check out the sample unity scene for an example of this.

    This would trigger the event on any collision with the button, which isn't ideal, as blinks, short glances, or eye-tracking errors could trigger the button. I'm not an expert here, but you could try incrementing a counter each collision frame and decrementing it each frame without a collision, triggering an event only when it reaches a certain value. That would help to ensure that the user is looking at it for an ongoing period of time.

    Comment actions Permalink
  • Avatar
    Junaid Ali

    Thanks a lot Sam! Much appreciated :)

    Comment actions Permalink

Please sign in to leave a comment.