Home Forums Game Integration Best way to trigger not 3D Objects

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9327
    Francesco Alotto
    Participant

    Hi all,

    I know that Tobii SDK right now is only able to trigger 3D elements.
    But what is the best way to trigger UI elements? Such as button?

    Could you please share your solutions?

    Thank you,
    Frank

    #9331
    Grant [Tobii]
    Keymaster

    Hi @franalotto94 and thanks for your query. Could you kindly clarify which hardware and SDK (Core, Pro, Unity, etc) you are using please and we will be better placed to help with your query.

    If perchance you are running the Core SDK, we have a premade sample that shows how to make WPF elements gaze aware which you can download @ https://github.com/Tobii/

    #9336
    Francesco Alotto
    Participant

    Sorry,
    I have posted in the wrong section…. The SDK is Unity SDK.. The hardware is Tobii Steelseries Santry

    #9337
    Alex [Tobii]
    Participant

    Hi @franalotto94 !
    We are currently working on a better solution for 2D elements.
    For now you can either manually compare the gaze coordinates with screen bounds of the 2D object or create invisible 3D colliders for them.

    #9345
    Francesco Alotto
    Participant

    Thank you for the fast answer…

    My objective is to trigger an UI Button contained into a Canvas.
    In my code I’ve:
    cursor.transform.position = new Vector2(smoothedpoint.x,smoothedpoint.y);

    Where cursor is an image that give information about the points where the user is looking.

    If the cursor stay over a button for more than 2 seconds, I want to trigger the button action.

    I’ve tried to use Raycast on void Update() function:
    `PointerEventData pointerData = new PointerEventData(EventSystem.current);
    pointerData.position = position;
    List<RaycastResult> results = new List<RaycastResult>();

    EventSystem.current.RaycastAll(pointerData, results);
    print(results[0].ToString());`

    But I don’t know how to achieve the timebased event. Using the mouse cursor, I’ve used the IPointerEnterHandler, IPointerExitHandler to set a boolean value to start the timer.

    Could you please help?

    I think that this solutions could be useful to a lot of users,

    Thank you,

    Francesco

    #9379
    Alex [Tobii]
    Participant

    Hi!

    You can find some good examples for 2D elements in
    CleanUI.cs and CleanUIForCanvas.cs

    #9428
    Francesco Alotto
    Participant

    Thank you,

    I’ve solved.

    Regards,
    Francesco

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