Touch detecting not working with Google Cardboard.
I wrote a script to make it so that the screen can be tapped for the player to move forward. Without any of the Google Cardboard scripts, this worked perfectly fine. But when I tested the Input.GetMouseDown
with the Google Cardboard, it didn't work. Any help would be greatly appreciated!
I'm trying to get this working too. This post is from last August, so maybe the bug that dolims refers to below is fixed now..? I can't see any reference to it in the Cardboard release notes though.
In my case, I'd really like to have both tap and swipe. This is totally possible in iOS using gesture recognizers, but I'm pretty new to Unity, so don't really know the best way to go about it. Especially once you add the Cardboard API into the mix.
Answer by meta-meta · Sep 15, 2015 at 03:18 AM
@dolims any advice for capturing a drag? It seems setting TapIsTrigger to false will get a click, but Input.GetMouseButton(0) returns true only for 2 frames or so.
Hmm... If TapIsTrigger is false, then you should see the actual down and up events from screen touches, and you should not get the up event until you lift your finger (or the trigger on v2 Cardboard). If you are getting an up event right away, it sounds like TapIsTrigger is still true, or you are using the magnet? You can also try Input.touches and check the phase.
No such luck.
void Update() {
Debug.Log("touch count: " + Input.touchCount);
}
When TapIsTrigger is false, this will output "touch count: 1" for about 2 frames while my finger is touching the screen. Interestingly, if I touch with 2 fingers, I'll get "touch count: 2" for 2 frames then it'll go back to "touch count: 1". So swipe works but only for 2 fingers.
$$anonymous$$y goal is to be able to spin the camera around for situations when it's inconvenient to look around a full 360 degrees.
No such luck...
void Update() {
Debug.Log("touch count: " + Input.touchCount);
}
When TapIsTrigger = true, This code outputs "touch count: 0" in Logcat whether I have a finger on the screen or not.
When TapIsTrigger = false, I get "touch count: 1" for about 2 frames and then it goes back to 0.
Interestingly, if I touch the screen with a second finger, i'll get "touch count: 1" (after 2 frames of "touch count: 2" if TapIsTrigger = true) and I'm able to drag. It seems Cardboard is eating my first touch.
I am not using the magnet. $$anonymous$$y code works as expected when not in VR mode. What I'm trying to do though is to allow the user to spin the camera around with a swipe so that if they are using the app in a situation where turning all the way around is inconvenient, there's still a way to see what's behind them.
Found a bug in the SD$$anonymous$$ (the Java part). It'll have to be fixed in an upco$$anonymous$$g release.
@dolims I have a similar problem, I just got the latest version of the sdk and the gaze input works on android, but click and drag does not work in the editor. I tried Setting TapIsTrigger = false on the Cardboard.SD$$anonymous$$ object but no luck. please help :'(
Your answer
Follow this Question
Related Questions
how to make dialog box and how can i scroll the text using UI GUI buttons in Android / Touch 0 Answers
How to play ambisonic sound files on android 1 Answer
Unity Daydream Preview - Raycast/camera alignment 1 Answer
Unity 3D UI Button Not Working When Touched (Mobile)? 1 Answer
When The Screen Is Touched Jump 0 Answers