UGAHacks 2015 1st Place – Michael Bottone, Ryan Smith, Neal Thacker
We signed up for UGAHacks a few days before the hackathon with absolutely no idea what to make. Shortly after signing up, I noticed my bike sitting in our apartment and thought, “Maybe there is something we can do with this.” I have a lot of experience with Oculus and other VR hardware, and my roommates Ryan and Neal have some experience with game programming in Unity and algorithm design.
A bicycle simulator was our first and best idea so we gathered up a stationary bike mount, two Wiimotes, and some duct tape and set off to UGAHacks. The last piece of the puzzle was an Oculus Rift DK2 from the MLH Hardware Lab. Then it was time to hack.
Our team immediately split up into two work groups, one focused on the Virtual Reality aspect of our hack and the other focused on the hardware integration.
Group 1 (Michael Bottone) – Hardware
I used our two Wiimotes to collect data from the real bike to input into the simulation. One Wiimote was attached to the handlebars horizontally to detect the rotation of the bike, and the other was attached to the pedal assembly to detect how fast the user was pedaling. This gave us enough to fully simulate the bike’s motion in our 3D world.
The lazy susan was placed upside down underneath the front tire to allow the user to rotate the handlebars smoothly during the simulation.
The software needed for this portion of the project mostly pertained to the Wiimotes. I needed to retrieve the raw accelerometer and gyroscope data over Bluetooth from the Wiimotes and then interpret it. I used the Unity-Wiimote library to get the raw data. For the spinning Wiimote attached to the pedals, my algorithm consists of a filter that averages past values and current values to reduce jitter and then uses trigonometric functions to convert 2-axis accelerometer data into an angular velocity. This is then multiplied by a constant to convert it into a linear velocity that is used to move the bike in the virtual world.
The code for the algorithms can be found here:
https://github.com/mbottone/uga_hacks_2015/blob/master/UGA%20Hacks%202015/Assets/Scripts/WiiMote.cs
Group 2 (Ryan Smith and Neal Thacker) – Virtual Reality
Our 3D world was created from scratch during the hackathon with the help of some model assets obtained online. We found the assets for a bike, some trees, and grass from here and here and paired them up with some default Unity assets to create our environment.
The physics of the movement of the bike also had to be calibrated. We made use of Unity’s physics rigidbodies, collision detection, and wheel colliders to create our main bike asset that would allow the user to ride through the world as realistically as possible without allowing them to fall over.
We tweaked the physics values for hours to make the simulation as realistic as possible. This included how fast the bike could travel, what kind of acceleration you would feel for a given pedal speed, how far you would turn for how far the handlebars actually moved, and more. Simulating a bike was far more intricate than we expected!
During this whole process, runtime performance was a major consideration. To run a project on the Oculus, your system needs to be able to render your world in two 1920×1080 frames at 75 frames per second or greater. This is quite a lot of rendering, so it doesn’t take much inside a world to prevent your system from running properly. We had to find the assets that looked the best at the lowest resolution possible, basically trying to find a middle ground between these two:
You can download our world here and try it out in Unity yourself if you’re curious how it turned out.
Finished Project and Conclusions
After just 36 hours of work, the bike simulator was ready for its first test users. We did demos for 40 – 50 people during the expo and noticed some very interesting things.
You can never fool the conscious part of someone’s brain into thinking they aren’t in a simulation but you can fool the subconscious part, and this is called presence in VR.
People’s bike riding instincts kicked in when they were on the simulator, a clear indication of presence. You could see them lean into corners as they turned or brace themselves for riding up a hill, even though both of those things were purely virtual. Everyone who rode the simulator talked about how weird it was because they knew it wasn’t real but they felt like it was. This is result of that conflict between the subconscious and conscious processes in the brain.
In the future, we would improve the simulator by adding more elements to increase the realism and presence in the simulation. We could add better tracking equipment, some sort of rig that would allow us to tilt the bike when someone was going around a corner or up a hill, or use increased graphics processing power to make more interesting worlds. However, this hackathon project was more of an exploration of how we could rig an existing bike into a working bicycle simulator with a very small amount of hardware resources. We achieved a working simulator that far exceeded our expectations and were very happy and honored to receive first place at UGAHacks.
A quick thank you goes out to UGAHacks and MLH for putting on a great hackathon and providing the Oculus Rift we used in this project. It was a great experience, and I would definitely recommend it to anyone who is interested in participating in a hackathon.