An experiment to show a virtual reality still image using Corona SDK. In theory, this could be an animation, too... feel free!
The app senses the physical attitude of the device using the gyroscope. As you turn the device, the image moves, as though you were turning your head. You can spin in a chair and see the world around you.
It seems to freeze in the vertical some times. Quit the app, shut it down, and it seems to come back.
This code uses Ultimote so the simulator will show the device activity. Here's Ultimote:
http://developer.anscamobile.com/forum/2011/11/13/corona®-ultimote
I believe it will work by commenting out these lines, if you don't have Ultimote:
local ultimote = require("Ultimote")
ultimote.connect()
The biggest problem at the beginning is that Corona SDK doesn't read pitch/yaw/roll, but uses the change in the gyroscope. The gyro drifts a lot, so this is not very stable. Hopefully, they will give us access to the other values, too.
Great job! I could see a lot of games could you these feature. I need to study the code but it really work great (iphone4) and VERY fast! I wonder how it would react if we add game objects over the image that scrolling around. I need to do some tests.
Thanks for sharing.
Mo
When I put this on my phone, the X Y and Z coordinates stay constantly at 0, almost like the virtual reality isn't working. Any thoughts?
Regards,
Jordan Schuetz
Ninja Pig Studios
Hi,
Is this on an Android? In my iphone4, it works great. The Y (up/down) is a little strange sometimes but X works great and FAST!
Its been a while since i tested it but if I recall you need to comment out the the lines about the accelerometer data coming from the Ultimote soft if you do not have it.
Hope this helps.
Mo
I have update the code to demonstrate:
- Swiping in addition to using the gyroscope. Tap to disable gyro and enable swiping to scroll the image; tap again to enable the gyro.
- I have added a hotspot, a button, to demonstrate that it can be easily done.
Hi,
Looking forward to trying this, but I think your link to Github includes your log-in username for Github so it didn't link through for me.
Thanks
Nick