For our team’s final immersive VR project (we previously made Desktop-Builder and Reston Dog Spotter VR together), we chose to make a simulation of an arcade with popular ball-throwing games. The ability to throw objects is key to a lot of VR games, so creating a simple arcade exploring different ways of handling this would be a good fit for our team’s first project creating a game in VR.
What Worked Well
- Different types of ball weights/throws
- We knew early on that with different types of balls they needed different weights and feels, so we set up different physic materials. Changing the mass of objects didn’t have an impact on throw distance at all, since the controller grab object threw the object at a velocity that just matched the player’s controller velocity. But we wrote additional code to add or remove velocity based on our perceived weight of the ball.
- For Football, we found that the way VR worked, recording angular velocity on object release, didn’t work well for football. I watched a Football Video and saw that when the football leaves the thrower’s hand, it shouldn’t really rotate forward or back at all, so I added a setting for the ball which controlled how much angular velocity would be allowed, and for the football we set it to nearly none.
- Non-VR testing System
- In order to test the game outside of VR, we put together a basic testing functionality that allowed us to walk around and pick items up, as well as throw them straight forward. This was immensely helpful in the early stages of the project when we wanted to test basic functionality. When we started finishing up the project we flipped off the boolean for the non-vr testing functionality and the testing transition was mostly seamless.
- Custom Models and Textures
- We decided not to create custom models for our past projects, but for this one we wanted to give the game its own aesthetic. The models and textures look great in VR and really give the game its own unique flair to help it stand out.
- Buttons in VR were more complicated than expected
- We did some googling to find a basic button mechanic, and I wound up implementing the system here – Pushable Buttons. But unfortunately that example didn’t include picking up objects in ADDITION to pushing buttons. In our game, the controllers’ colliders were triggers so that they wouldn’t psuh away objects players were trying to pick up, but to make pushing buttons natural it needs a collider. In order to fix this, you need to dynamically check whether the controller collider should be a trigger (ball to pick up) or not a trigger (button to push). In the end we had other things we wanted to fix, so in the game you have to grab the buttons to press them down.
- Nested Prefabs (and prefabs in general) are a danger zone
- Sometimes, nested prefabs do exactly what you expect. Sometimes, they don’t. We didn’t have enough experience to know what we were doing wrong with nested prefabs, but we had issues with the different throwable objects linking to the same prefab, so when we updated the skeeball ball it was updating the basket toss object as well. After we unlinked the prefab and took away the 30+ components that spawned on objects as we were clicking “apply all” to our prefabs, we had a much better time.
- It isn’t that prefabs are bad, it’s just that if you don’t understand how they really work (or you spent WAY too much time getting used to the Unity 5.x prefab system) then they can be a source of a lot of painful bugs.
In the future, we might want to make a version of the game that goes beyond a simulation of an arcade and creating new experiences using the fundamental concepts we learned here.