If you’re working on developing a VR game, chances are that you’ve hit the problem of recalibrating and keeping scale of your game consistent with user height. Every time you create a virtual world, its set on a specific scale that follows the real-world architectural dimensions. Everything in that world is designed by keeping a certain value of user height in mind. For instance, you input your height (5’7”) while designing the game, keeping all virtual objects scaled to that value so it follows realistic dynamics of the world. Once the game is ready, you ask your friends to come and test it. They put on the headset and start the experience. But what’s this? Everything in VR looks smaller than it should.
What went wrong?
Here’s the thing. The entire game is built in reference to desired height of 5’7” but your friend is 6ft tall. When he puts on the headset, everything looks smaller in comparison as if looking from a higher position. What if the next person who plays the game is shorter than you? Since you can’t know heights of all the users who’ll experience it in their headsets and they can drastically vary on the scale, this raises a very important question.
How do you deal with different player height HMD without making them feel like a giant or a dwarf in your game?
One way is to somehow scale the virtual world to user perspective so that he doesn’t feel bigger or smaller than their real height. Although scaling the model to each player’s height can certainly be done, other simpler solutions are possible too. Instead of transforming the game model every time a new player logs in, it’s rather simpler to assign the player a desired height that compliments your VR model.
Here’s what you can do to fix main camera height to get desired height. We call it Universal VR Height Module and this is how it works:
The first step is to get the actual height of the player which we’ll refer to as current height.
Next step is to move player’s height to the desired height. It sounds simple enough, but there’s the matter of getting the transform position ‘Y’. To get to Y we need to subtract current height from the desired height. For instance, you want all players to be scaled to 5’7” in VR. When a taller or shorter person puts on the headset, our solution calculates the difference between the two heights and adjusts accordingly to scale it down or up to the desired value.
Since the main camera is attached to the VR headset we cannot update the camera transform position in our game. Instead, we create a Parent Game Object, assign it to Y and make the main camera its child. This helps us change the transform Y in Parent Game Object and get the view according to the desired height.
Universal VR Height Module lets every player enjoy a universal virtual reality experience without getting into the hassle of moving sensors up and down or putting burden on dev side. There’s no need to go back to home setup and recalibrate heights for every new user that puts on the headset. The biggest benefit of this solution is that it can be integrated into any VR app or game and will let people enjoy a universal view, regardless of their real-world height.