Home › Forums › Game Integration › Best way to trigger not 3D Objects
- This topic has 6 replies, 3 voices, and was last updated 5 years, 9 months ago by Francesco Alotto.
- AuthorPosts
- 10/02/2019 at 17:37 #9327Francesco AlottoParticipant
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,
Frank10/02/2019 at 22:05 #9331Grant [Tobii]KeymasterHi @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 #9336Francesco AlottoParticipantSorry,
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]ParticipantHi @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 #9345Francesco AlottoParticipantThank 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
16/02/2019 at 15:12 #9379Alex [Tobii]ParticipantHi!
You can find some good examples for 2D elements in
CleanUI.cs and CleanUIForCanvas.cs21/02/2019 at 00:28 #9428Francesco AlottoParticipantThank you,
I’ve solved.
Regards,
Francesco - AuthorPosts
- You must be logged in to reply to this topic.