Designing and developing HUD/UI
Hi guys,
Any tips on developing an interactive User interface. Actually, I'm trying develop a 2D panel in which I'm supposed to play a video. The button controls such as playing and pausing the video are supposed be controlled with the gaze. What's the best way to trigger the 2D Button presses (For now I m using collisions for this purpose)?
Also, for now I m using a Canvas with render mode as 'World space'. Is this a good approach?
Any suggestions, materials or links in this regard would be appreciated.
-
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.
Please sign in to leave a comment.
Comments
2 comments