Home › Forums › Game Integration › Best way to trigger not 3D Objects
- This topic has 6 replies, 3 voices, and was last updated 4 years ago by Francesco Alotto.
- 10/02/2019 at 17:37 #9327
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?
Frank10/02/2019 at 22:05 #9331Grant [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/10/02/2019 at 22:32 #9336
I have posted in the wrong section…. The SDK is Unity SDK.. The hardware is Tobii Steelseries Santry10/02/2019 at 22:55 #9337Alex [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.12/02/2019 at 11:42 #9345
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>();
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,
Francesco16/02/2019 at 15:12 #9379Alex [Tobii]Participant
You can find some good examples for 2D elements in
CleanUI.cs and CleanUIForCanvas.cs21/02/2019 at 00:28 #9428
- You must be logged in to reply to this topic.