Rube Goldberg game In Virtual Reality(Udacity Project)
This is a Rube Goldberg project from the Udacity Nanodegree. We were tasked to design and build a high-immersion VR game where we get to learn concepts such as physics mechanics, locomotion, and interaction.
You need to have a basic understanding of Unity to follow along. At the end of the article, you would learn how to set-up project for SteamVR, different locomotion methods and interaction of objects.
I didn’t figure the game out until after watching videos on how it works. The game is influenced by the Rube Goldberg machine shown below.
Rube Game Machine
A Rube Goldberg machine is a deliberately complex machine in which a series of devices that perform simple tasks are linked together to produce a domino effect in which activating one device triggers the next device in the sequence
I’ll walk you through the simple mechanics for the Rube game in VR which is going to work on either HTC Vive or Oculus Rift.
To better understand the game, here is the final video:
1.0 Objectives
The objective of the simple game is to allow users create their own contraptions or domino effect with the available objects provided in the game.
These objects have unique behaviors such as the what is shown below.
1.1 Plank
1.2 Trampoline
1.3 Fan
1.4 Metal
2.0 Tools To Use
Before starting, you will need the following:
- Unity package
- VR desktops for HTC Vive and Oculus. Here is an example of how it looks.
- HTC Vive headsets with controllers
- 3D models from Unity asset store
- Steam VR plugin
NB: Some of these tools like the HTC Vive headsets, VR desktops are a bit pricey. If you can’t afford them, you can use them at some VR labs near you, for example, Imisi3D Lab
3.0 Building Process
Like I said before, this game will be built for High-immersion VR. We’ll be using the Steam VR plugin. Steam VR will provide us access to tracked controllers which we will be used for teleportation and object spawning. It will also give us access to loading different scenes or play modes in our Rube Goldberg game.
An alternative to Steam VR is GVR. GVR unity SDK is used for mobile VR. Here, I wrote about the difference between mobile VR and High-immersion VR.
Let’s get started
3.1 Setting up Steam VR
After you have downloaded and installed Unity on your system, create a New Project and add the SteamVR plugin from the asset store.
Make sure your HTC or Oculus headset, controllers, and sensors are plugged in correctly to check if SteamVR is working.
Always restart your SteamVR and your computer any time you run into problems with using the plugin. Once your SteamVR is set and your controllers and headsets are all plugged in, you are ready to use SteamVR.
3.2 Teleportation
Locomotion is really important and needs to be done right because you don’t want to cause motion sickness for your users. There are different locomotion:
- Artificial Walking
- Teleportation
- Dashing
Teleportation is implemented in our Rube game because it has the lowest risk for locomotion sickness. To learn more about teleportation, here is a video of the different locomotion methods.
The SteamVR tracked object component is responsible for teleportation in SteamVR. This component needed for teleportation is added to the controllers together with a ControllerInputManager script which I created to handle teleportation. To learn more about the SteamVR tracked object component API, check out the doc on Unity.
This is the logic for the teleportation;
Our teleport will shoot a Raycast from the hand controller when the trigger button is pressed, which will then teleport us to the position it collided with.
Teleportation around the game area
3.3 Grabbing and Throwing
For this game, we need to pick and throw our ball to interact with the Rube Game objects.
This is the behavior for grabbing and throwing the ball;
A player can touch the ball object, squeeze the trigger on your controller to grab it and move it around, then release the trigger to throw the ball.
The ball Object is given a tag of Throwable and it’s attached a collider, which is a sphere. Colliders help to describe the shape of game objects in this case, the ball for the purposes of physical collisions. A RigidBody is also attached to the ball to allow it move.
4.0 Break down of the Game
The game has 4 levels, and each level has a specific number of stars that the ball has to hit before moving to the next level. In order to hit all stars, you must create your contraptions with the objects provided e.g Fan, plank, metal e.t.c.
Once the ball hits, collects the star and lands on the goal platform, a new game level is loaded.
I still have a lot of iteration to do in the game to make it really cool and super entertaining.
5.0 Conclusion
I really enjoyed the thought process around the game, the implementation phase and user testing. Here is the repo for the project itself and I would love for you to contribute to it.
6.0 Next Steps
I need to put more effort into making the environment and objects look really cool, and the experience seamless.
Here are other links to my work on VR: