Sponsored By

Adding OculusVR support

I've just released (beta) support for the Oculus Rift in Leadwerks Game Engine. The implementation was much simpler than I expected, and isn't intrusive at all in our game structure.

Josh Klint, Blogger

December 1, 2014

2 Min Read

Previously, I wrote about my experience trying Valve's VR room.  Since then, I graduated from my MBA program and moved up to Seattle to be closer to the PC gaming industry.  (Previously, I lived an hour away from Silicon Valley, but it's more mobile-centric there.)

I've just released (beta) support for the Oculus Rift in Leadwerks Game Engine.  I am targeting the latest OculusVR SDK and not SteamVR at this time, but I am definitely open to adding support for a range of hardware.  The implementation was much simpler than I expected, and isn't intrusive at all in our game structure.  To enable VR in any game, you just add the Window::VRDisplay flag in the creation flags in the Window::Create() function:

Window* window = Window::Create("My VR Game",0,0,1024,768,Window::Titlebar|Window::VRDisplay);

 

Or in Lua:

local window = Window:Create("My VR Game",0,0,1024,768,Window.Titlebar + Window.VRDisplay)

 

Head tracking and rotation are just automatic, and it works with pretty much any game.  Of course, you likely will want to adjust your control scheme for VR mode, as I find bad controls to be the biggest offender of nausea inducement.

I added the following commands for extra control over the simulation:

Vec3 VR::GetHeadRotation()

Use this to modify the way your controls work.  For example, use the player's head rotation to change the direction they move in when a key is pressed.  You do not need to rotate the camera yourself, as this is done automatically.

Vec3 VR::GetHeadPosition()

If you do any line of sight tests this would be useful.

void VR::Recenter()

Recenters the headset orientation according to the current position and rotation.

void VR::HideWarning()

Disable the Oculus warning popup, typically by pressing space or another key.
 

Overall, I found the Oculus Rift DK2 to be a big step up from the DK1, but the speed and tracking are still behind SteamVR.  With the DK2 I sometimes get that feeling of presence, but as soon as I start to get into it the illusion is often broken with bad tracking or lag.  I'm sure this will keep improving and I look forward to seeing what the final consumer hardware looks like.

Read more about:

2014Blogs

About the Author(s)

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like