Is it possible to focus and open up the information just like we do on click using magnet in cardboard android? Like ray gaze in unity, is there a alternative for android? I want to do something like the one shown in chromeexperiments
Asked
Active
Viewed 508 times
4
-
Did you find any solution for it? – Milad Yarmohammadi Oct 04 '16 at 12:44
-
1@MiladYarmohammadi sorry haven't found any solution for it yet. – pallavi Oct 05 '16 at 03:40
2 Answers
1
Finally solved!
In treasurehunt sample, you can find isLookingAtObject()
method which detects where user is looking...
And another method called onNewFrame
which performs some action in each frame...
My solution for our problem is:
in onNewFrame
method I've added this snippet code:
if (isLookingAtObject()) {
selecting++; // selecting is an integer defined as a field with zero value!
} else {
selecting = 0;
}
if (selecting == 100) {
startYourFunction(); // edit it on your own
selecting = 0;
}
}
So when user gazes 100 frame at object, your function calls and if user's gaze finishes before selecting reaches 100, selecting will reset to zero.
Hope that this also works for you

Milad Yarmohammadi
- 1,253
- 2
- 22
- 37
0
Hope this helps. (Did small research, (fingers crossed) whether the link shared below directly answers your question)
- You could check GazeInputModule.cs from GoogleSamples for
Cardboard-Unity from Github. As the documentation of that class says:
This script provides an implemention of Unity's
BaseInputModule
class, so that Canvas-based UI elements (_uGUI_) can be selected by looking at them and pulling the trigger or touching the screen. This uses the player's gaze and the magnet trigger as a raycast generator. - Please check some tutorial regarding Google Cardboard Unity here
- Please check Google-Samples posted in Github here

a3.14_Infinity
- 5,653
- 7
- 42
- 66
-
Hi gansai, thankyou for the response. But i need ray gaze functionality in cardboard android, and not in unity. some similar function which does the same logic. – pallavi Sep 29 '15 at 11:23
-
Hi @pallavi, Could ray-gazing functionality in cardboard android be done using unity plugin for android? (https://developers.google.com/cardboard/unity/get-started) – a3.14_Infinity Sep 29 '15 at 11:30
-
i think it can be done has there is reference for it in [cardboard google](https://developers.google.com/cardboard/unity/reference) Ray Gaze property in **CardboardHead.cs**. so i wanted the same kind of functionality in android just like in unity. – pallavi Sep 29 '15 at 11:46
-
Good to hear that. :). Just checked code in github, found the Ray Gaze property - [github code](https://github.com/googlesamples/cardboard-unity/blob/master/Cardboard/Scripts/CardboardHead.cs) – a3.14_Infinity Sep 29 '15 at 11:51
-
good to know that, but i am looking for android and not using unity, so if you get any reference regarding android cardboard, please post it, thanks. – pallavi Sep 29 '15 at 11:57
-
So, (just to be clear), you mean to say that you want to develop purely using [Google Cardboard SDK](https://developers.google.com/cardboard/android/) and do not wish to use [Unity Plugin](https://developers.google.com/cardboard/unity/) at all, right? – a3.14_Infinity Sep 29 '15 at 12:02
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/90884/discussion-between-gansai-and-pallavi). – a3.14_Infinity Sep 29 '15 at 12:05