Day 63 – Walking around in VR
Today I worked on some basic VR player controls, first trying to get the player to walk around inside the scene.
The VR controls themselves are not too difficult as there are good frameworks available to help with that. So it’s more a matter of finding out how to make them work with the Adventure Creator asset (AC).
On the PC I had it setup that the player can move around by using the arrow keys, and look around with the mouse while holding the right mouse button.
In VR I use the two hand controllers (from the Oculus Quest in my case). The stick on the left hand controller is setup the move the player back, forward and sideways in a continuous fashion. The stick on the right hand controller is used to snap turn the player direction.
A lot of VR games use a teleport mechanic to walk around instead of continuous movement. Reason being the risk of motion sickness is bigger with continuous movement. Adding a teleport option is something I’ll try later.
Hooking up the AC player with the VR rig took some figuring out, but I think the result is good enough to move forward (pun intended).
Looking at things
Player movement is just the first part of the equation, looking around is the next one. Of course, in VR you look around like in real life: by turning your head (in technical terms by using the head mounted display – HMD).
With the mouse/keyboard controls I require the player to hold the right mouse button to look around. If the right mouse button is released the player just moves the cursor, allowing them to hover over interactable items.
With mouse/keyboard it’s a one or the other type of situation, but in VR you have more controls available. You can always look around with the HMD but at the same time you’re holding a controller in each hand that you can use to point at things.
To test I added rays to both hand controllers to see where I’m pointing at, also common in VR games. I then hooked the ray mechanic into AC’s hotspot detection and I now detect which hotspot I’m aiming at with my hands.
Currently I only highlight the detected hotspot, there’s no label shown or interaction possible. Tomorrow I’ll try to get the label working.
That’s not as straightforward as it might seem because in VR the UI elements need to be positioned inside the “physical world” to feel right, whereas in a regular game they are simply projected on the screen. Suffice to say I’m expecting to run into some challenges.
Anyways, I haven’t quite figured out the best way to make a recording from VR yet, but here’s an attempt to showcase the changes while wearing the VR goggles.
Leave a Reply