Creating a Drawing Game in Virtual Reality
Over the past couple of months I have been working on a Virtual Reality project using Unity and my Oculus Quest headset, and I was able to create a drawing game in VR for my first time experimenting with Unity and Oculus. I went through a lot of trial and error with this project and many learning experiences, but this is what I ended up with and how I got to acquire all the knowledge and skills I have so far.
This past year I have been exploring new technologies because of an extra curricular program I do called The Knowledge Society. In this program, we got to do a project on a technology we were interested in, and I wanted to do a project on a technology which had some elements of art. Art was something I was already passionate about, so I chose to focus on AR/VR to create a drawing based game. When I first looked into AR/VR, I noticed that it had art aspects like 3D models and design, so I began to dig deeper into it. I started with a couple small AR projects, like following web based and marker based AR tutorials. These AR tutorials taught me how to put different objects onto AR markers using some basic code. I completed these projects to get more of an understanding about AR/VR and the different ways to use the technology. Then, I started my bigger VR project which I did without the use of a step-by-step tutorial.
At the start of my project, I wanted to tie together art and technology to attempt to sculpt in AR, but after talking to professionals and researching more in virtual sculpting, I decided that it wouldn’t be the best to follow through with that project because it would be difficult to do as my first project and hard to achieve in AR. To make things more realistic for myself, I switched to VR to utilize the many tools for creating VR interactive games in Unity, and switched my game concept to painting/drawing in VR.
For this project, I decided I wanted to do an interactive drawing game in VR where you could have a canvas and draw just like in the real world, but digitally. I began with using Unity and got to know the platform using tutorials and articles. Also, I already had an Oculus Quest headset which made it easier to use VR because I didn’t need to buy a headset. The main parts of my project were hand tracking, gesture detection, creating the marker model and drawing using the trail function, and the scene set up for my project.
Hand tracking and gesture detection are functions which come in the Oculus Integration package, which is a package that Oculus created with Unity to make developing on the Oculus Quest headset easier and less time consuming for developers. Hand tracking tracks your hands using the Oculus camera and displays a virtual copy of them in your VR application.
Hand tracking is used to be able to see your hands in VR and also interact with objects in your game by using gesture detection. Using the Oculus Integration package, you can choose a gesture that your computer will be able to recognize. Your hands can then make that specific gesture and interact with different things in your game. For example, you could make a thumbs up sign which could change the colour of an object, or a grab motion to interact with an object. Adding gesture detection makes the game more real world like. I used the grab and pinch gesture to be able to grab and/or pinch the drawing markers in my game. It was a pretty easy set up because of the Oculus Integration package, and it made my project more immersive and more like real life drawing.
For this project, I also looked into Blender for creating the drawing marker model. I created a 3D model in Blender which I was able to do after a bit of blender navigation and tips from YouTube and other sources.
The drawing part of my game was done by adding a trail to my 3D model of a marker, and then changing the colour to match the colour of the marker. I also changed some other settings to match the size of the trail to the marker and changed the time of the trail limit to a very large number so it wouldn’t disappear.
Finally, I set up the scene to have a white table to look like you are drawing on a piece of paper, and a plane for the floor.
Overall, I enjoyed learning about AR/VR and how using it I could create something which tied together my two passions, but I still have a lot to learn about this technology. I am proud of what I have achieved this year with learning about AR and VR, but I also want to improve areas in my project within the next couple of months.
What I want to add/change:
- An erase function, this would require changing the way the drawing is done in my game because you can’t intentionally erase a trail, it can only go away after a certain amount of time
- Making the scene more interesting, adding a backdrop, making the whole area look nicer
- I also want to improve my C# coding skills to make more complex games in the future
If you enjoyed reading about my experience with creating my first VR game, check out my other articles on my page which include articles about my AR experiences and other projects I have done :D. Thanks!