- Home /
Anroid Gyro, Calling a function when phone is fliped once over.
I'm assuming this would use the gyro functions for android. I'm not exactly positive, and I don't know where to exactly begin. I've seen examples controlling the camera, using the accelerometer.
What I'd like to do. Is calculate something like this.
Phone is flipped over completely in one direction as in you see the front of the phone, and you see the back of it, and then the front again, and then call a function. An if statement of sorts.
I'd appreciate any input on how this would be tackled as I think it's a pretty good one and would give some insight for future developments for everyone.
However, I have searched a bit on the topic and may have worded it wrong, so if I missed this topic and it has been covered already. My apologies.
Thanks in advance.
Answer by KrisCadle · May 19, 2011 at 09:27 PM
// Play a sound if screen is facing downwards
function Update () {
if (Input.deviceOrientation == DeviceOrientation.FaceDown)
audio.Play();
}