[Google VR] Do you need a controller?

Hi All

I have been working with the Google VR for Unity and wanted to give Unreal a go. Do I need a controller to make a simple forward/left/right/stop app? There was some reason I had to abandon Unreal for Android/Google before.

Thanks

Well… If you want the user to give input, you’ll need some sort of way to collect input from the user. Whether that’s with a mouse and keyboard, a button press, positional offsets, a motion controller, or something else, is up to you to decide.

Hi Slayemin

Unity allows you a point to look at; extreme up. Once you see the point and it is acknowledged by the phone, you will start to move forward. If you look left or right you will turn in that direction. Then, you can look (i think) extreme down at a point and it is acknowledged by the phone, you will stop. You then can look around until you wish to repeat the process or exit the game. Does Unreal allow this type of control?

Yes, sort of. What you’re describing is movement based upon the HMD orientation. I don’t know anything about mobile VR hardware capabilities, but I can say with 100% certainty that you can grab the orientation and position of the HMD for Oculus Rift and HTC Vive. Some mobile VR devices only support positional tracking or orientation but no position, so you’ll want to check your hardware capabilities. If the hardware supports position and orientation, then you can certainly grab that data from a blueprint node or from the “UHeadMountedDisplayFunctionLibrary” class.



FVector HMDPos;
FRotator HMDRot;
UHeadMountedDisplayFunctionLibrary::GetOrientationAndPosition(HMDRot, HMDPos);


What you do with this data is up to you. In my game, I had a system where I displayed an item selection menu when the player pitched their head down -30 degrees, but that could just as easily have been interpreted as a movement input if I wanted to design my game for that.

Personally, if I had to implement a movement system for VR which doesn’t use buttons, I would go with a relative positional based system. So, if you start the game, the VR HMD is at the origin [0,0,0]. If the player wants to move forward, they step forward 10cm. That corresponds to a relative movement from the origin, which puts their relative offset at [0,10,0]. That is then interpreted as a forward movement input with a constant fixed speed. You could also make the speed be fixed increments to account for judder, so someone standing at 10.0 and 10.4 would both move at some preset speed rather than 10.0 and 10.4 respectively.