Building a Virtual Reality Experience: VR Motorcycle Race

Zaynah Bhanji
3 min readOct 14, 2018

--

Virtual reality is a computer-generated simulation or world where your entire view is virtual. We can manipulate this virtual world and do some really amazing things. This is a project I built for the Google Cardboard in the Unity Game Engine, called VR Motorcycle Race. In this experience, the user is riding on a motorcycle and their objective is to avoid all of the objects on the path.

Video Demo of VR Motorcycle Race

In this experience, the user is in a dusty and sandy environment and is challenged to avoid all of the objects. The user has to get to the finish line in the least amount of time that they can.

Breakdown of Gameplay

Environment

The experience starts in the sandy environment on the road, and the user is shown the time. The user has to turn their head to avoid all of the objects. If they hit an object, they will automatically slow down for two seconds. The user’s time will be displayed when they cross the finish line.

Obstacles

Cow Obstacle

Obstacles randomly appear on the road while the player is moving forwards. The three obstacles in this game are stop signs, cows, and barrels. These objects cover a part of the road so that the user has to move their head to avoid them.

Movement

Automatic Player Movement

The player moves automatically on the road, and they get faster and faster until they hit an obstacle. When an obstacle is hit, the player slows down for 2 seconds, and then starts getting faster again.

Game Mechanics

Randomization of Obstacles

The objects are randomly selected and are randomly put on the road.

Choosing a Random Object

The highlighted line uses “Random.Range” to randomly select one of the objects.

Position to Place Object on Road

The highlighted line shows uses “Random.Range” to select an x value to place the object on the road.

Movement

Movement of the Player

This shows the values of the movement of the player. The player accelerated at a speed of 0.5 with a maximum of 10. When the player hits an obstacle, it slows down to a speed of 0.25 for two seconds, and then starts accelerating again.

If you enjoyed this article:

  • share it with your network
  • follow my Medium and LinkedIn to stay updated with my progress in virtual and augmented reality
  • check out my personal website to see more of my projects!

--

--

Zaynah Bhanji

15-year-old machine learning and VR/AR developer. Working with companies like Google, TD, Microsoft and CIBC to further my skills.