August 30, 2018
Eldon Schoop: I did everything
GitHub repo (most relevant file linked): https://github.com/eldon/VR_Painting_Demo/blob/master/Assets/Scripts/Draw.cs
Narrated video demo: https://www.youtube.com/watch?v=5eVsWQDKKME
Features implemented:
- Cursor is visible to users. In particular, a sphere is drawn with identical width and color to the selected line settings.
- Once the trigger of the Vive controller is pulled, a continuous line will be drawn from the cursor
- Users are able to change line width by clicking up and down (Y-axis) on the Vive controller trackpad
- Users can change the color of the line by scrolling on the X-axis on the Vive controller trackpad
- The entire scene can be cleared by pressing the "menu" button on the controller
- (Extra credit) The last line can be deleted ("undo") by squeezing the controller
I didn't have access to Blum Hall and needed to get this assignment done quickly, so I used a Vive in Lab with Unity and SteamVR. One of the most difficult aspects of the assignment was getting used to the dev environment (I had never used Unity before), and getting to know the SteamVR api (documentation is practically nonexistent). However, I found a nice tutorial which helped me get started (https://www.raywenderlich.com/792-htc-vive-tutorial-for-unity).
Surprisingly, the easiest part to implement was the line drawing itself! I used a LineRenderer in Unity and stitched points from the cursor's location each frame. Bala suggested I create a new GameObject with a LineRenderer each time a new line was drawn, which worked great. A couple frustrations: figuring out how to get the lines colored properly took a lot of trial and error (had to find the right shader, with no obvious place to look first, and none of the default ones worked). Orienting the menu UI sprite on the controller was a bigger pain than expected -- I learned I needed to do it through scripting, by creating a new GameObject, attaching the Sprite, then manually orienting it.
Overall, the assignment was much less frustrating than expected (yay!). :) If I had more time, I'd like to implement a prettier UI for the color picker, and maybe trigger a haptic output on the controller if you collide with a line.