FINAL VIDEO: Attach::VRFinalShowcase.mov
Last semester in this course I was working on a horror game called Spookytown for my thesis. It's a mouse and keyboard game, but this time for this course I got the idea to add VR to my game. So then it can be played both normally and in VR. I am not familiar with VR development at all, so it will be a challenge to figure everything out and implement everything that I want to. I am using Unity.
Some screenshots of what the game looks like so far:
Milestone 1 (03.03)
- Figure out how to make my VR headset work with Unity (4h)
- Add the ability to move around with VR controllers (3h)
I spent more time on this milestone than I had initially written. I managed to get VR to work with Unity. It took a while, because at first my PC didn't detect my headset, and after lots of troubleshooting, trying to update drivers etc, it turned out that I had to update to Windows 10 and then I finally got my headset to work. I downloaded an asset from the asset store by Valve to make Unity compatible with SteamVR. Then I added smooth locomotion, controlled by the joystick, which took a long time to figure out because I didn't know how to bind it to a button, but I finally figured it out and now it works.
Milestone 2 (17.03)
- Add the ability to teleport around (3.5h)
- Make it so you can't put your head through walls and objects (2.5h)
- Fix hands glitching (1h)
The milestone was successful, first I added teleportation. The teleportation was already sort of built-in, but I had to give the ability to let the player teleport in my level and tweak the script to make teleport areas not visible (otherwise the ground of my entire level would be covered with a teleport area marker and I don't want that). Also, I had to make sure the teleport beam wasn't blocked by the invisible triggers which I have a lot of in my level, which took a while to figure out.
As for the head and walls collision - First I tested just making the view black if the VR camera is colliding with something. That did not work so well, because my walls are just planes, which means they are very thin, so you could very easily put your head through it completely and since you would no longer be colliding with it, your view would no longer be black and you could see everything behind the wall. Also, you could teleport to areas behind the wall this way. I had to make it so the head collides with walls and prevents your VR camera from going through, which solved both of these issues.
Fixing the hands glitching took a while to figure out, I suspected that the hands are colliding with the player's collider that I use for physics, so I kept changing the layers and collision mask and it didn't work for some reason, but when I set the entire player and all its children to a new layer, and disabled that layer's collision with itself, which initially didn't solve the problem, but when I also set the hand prefabs to the same layer, then the issue was solved.
Video showcasing glitchy hands: Attach::stvrmilestone1-1.mp4
Video showcasing head going through walls: Attach::stvrmilestone1-2.mp4
Video showcasing the result: Attach::stvrmilestone2.mp4
A better showcase of head being blocked by walls: Attach::stvrmilestone2-1.mp4
Milestone 3 (31.03)
- Change the dialogue system for VR (it will still be same in non-VR, but if you are playing in VR it will be different) (3h)
- The current dialogue UI doesn't show in VR view, and even if it did, it would be strange because VR games usually have world-space UI. Therefore I will make world-space text appear in front of a character when they are speaking.
- Make a VR pause menu for the game (4h)
- Has to appear in front of you as world-space UI
- Allows you to press buttons on the UI with your controllers
- Has an option to switch between smooth locomotion and teleportation
The milestone was a success, when playing in VR the dialogue system is different - character's dialogue text shows up in front of them on world space UI. I also made it so you don't have to press any buttons to progress the dialogue like you had to do on the non-VR version, here it instead waits a couple seconds for you to read it and then the character says the next thing - this also helps for immersion since it feels more like the character is talking for real.
I also made a pause menu that can be activated with a button on your controller, the pause menu also appears in front of you on world space UI and has the options to resume, go to the settings, or quit. The settings has an option to switch between smooth locomotion and teleportation, and the change takes effect automatically.
Results showcase: Attach::VRShowcaseM3_.mov
Milestone 4 (14.04)
- Make it so you can pick up certain objects (with your VR hands) (2h)
- In the non-VR version you can pick up certain objects by pressing E but you can't do that in VR
- Make it so you can open doors and interact with buttons (5h)
The milestone was completed successfully. Physics objects that can be picked up with E in the regular game can now be picked up in VR as well, using your hands. Doors can now be opened by grabbing the door handle and moving the door with your hands (it rotates around the hinges), and buttons and levers can be interacted with, for levers it was very complicated to make it so you actually pull the lever yourself (due to the system I'm using), so I made levers work like buttons - you press your hand against the lever and the lever gets pulled automatically.
Results showcase: Attach::STVRMilestone4Showcase.mov
Milestone 5 (28.04)
- Make sure the game can be played entirely through in VR with no issues (2h)
- Make it so the game can be played in the expo with no issues (5h)
- Making a build for VR gameplay
- Compatibility with expo's headset
- Compatibility with expo's controllers (bindings)
Test build: https://drive.google.com/file/d/1vrObZl95JcIe0ieGnZjLoUj6hle92Y4I/view?usp=sharing
Improved build: https://drive.google.com/file/d/1NOJ3fEL-IGQTuplBHAm9KrF_uVKT2_qr/view?usp=sharing