Close

Final Update

A project log for VR Integration in Stationary Bikes

I bring the outside... inside

nityanagrawalnitya.n.agrawal 06/01/2018 at 13:590 Comments

Methods to make project: 

Designing VR Race Car Game

Before designing my own virtual reality game, I first learned the foundations of Unity through an online Udacity Nanodegree course. After learning about the basics tools, I started out by making a 3D plane object for the terrain and lowering and raising the terrain in order to make the mountains and valleys. Rocks, asphalt, and grass textures were then imported in order to make the virtual reality more real. A standard asset car was then placed into the scene through the Assets provided by Unity and a camera stabilization code was attached in order to reduce motion sickness. Two different tree objects were later placed throughout the scene in order to prevent the player from cutting across the map and finishing the game early. The billboard start value was also adjusted so that the trees would be rendered nicely and not just appear as soon as the car came closer. To test this game, users were asked questions and improvements were made throughout the process (Appendix A).

Development of Hardware

A photoelectric sensor was implemented and attached to the bicycle in order to determine the rate that the player was pedaling at. A photoelectric sensor detects the light beam reflected from the pedal when it passes (Appendix G). Data is continuously collected for two seconds and the number of times the pedal has passed the sensor is counted. After comparing if the user has sped up, slowed down, or stayed constant from the previous two seconds, commands are transmitted to Unity. A “3” means that the user has increased their speed, a “2” means that the user has stayed constant, and a “1” means that the user has reduced their speed. The readings from the SerialMonitor were recorded in order to determine that the code was efficiently working. One of the main issues that arose from this setup was that the baseline value for the sensor would change because of external light and a calibration reading was implemented to make for easy changes (Appendix F).  

Integration of Unity and Arduino

The first approach to integrating Unity and Arduino was through the serial port. Because Unity doesn’t have the needed libraries to do this, I included the full .NET 2.0 library in the player settings. To initialize the port, the port and the baud rate was needed and the System.IO.Ports was imported in order to do so. Using the commands of Serial.write and Serial.flush help to transmit the data from Arduino (Appendix E). Unable to make the direct connection between the two softwares using serial port, I realized through research that direct serial connection doesn’t work on Macs (Appendix D).  Instead, a SerialProxy implementation was attempted in order to configure the connection, however, that link also failed to be established (Appendix C). Because of the problem that occurs with Macs, in the future I would transfer all my work to a Windows computer and try again.

Results of my project: 

The game terrain was overall designed very efficiently and was engaging for the user. Because user testing was really important in determining the quality of the game, if it was fun to play, and how players felt in the environment, I asked my peers and family on their input. I not only wanted their overall opinion, but I also asked tailored questions such as, “Does the environment make you feel like you are playing a race car game?”, “How does the audio make you feel”,  and “Is the size of the car accurate in relation to the other game elements?” Most of my testing was done through my mom who helped me improve the environment and the map that was made. Vaishnavi Mantha noted that the game was entertaining, however, she very quickly found a shortcut and way to cut through the middle of the map. After seeing this, I added barriers to the side of the road to force players to stay on the designated path and further added trees to enforce that players could not find another path. After fixing that issue I asked other friends, such as Ramia Rahman. Ramia also liked the game, however, she stated that because of how fast the car was going when it went over the bumps it caused her motion sickness. To overcome this, I lowered the overall speed of the car in the script. Through more user testing, I was able to determine other unexpected problems, such as unusual features on the map. Another problem that I ran into was working with the prefab for the Unity car given in the asset store. The MobileControlRig was very hard to modify as it was a script given by Unity and instead I wrote my own script to control the movement of the car. Although controlling the car with head movement would be optimal, I had to control it using buttons as it was easier to implement in the given time.

The photoelectric sensor worked as expected meaning that it effectively transmitted data from the Arduino. Everytime the pedal passed the photoelectric sensor the data would change, however, a problem that I ran into was the need for calibration because the changing in light when I tested it at different times. To overcome this in the future, I can write a more robust algorithm that looks for the difference in incoming light instead of making the base line reading from the sensor a set number. I can also add a shield to protect the sensor from external readings.

Discussions