informa
2 min read
article

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.

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.

Latest Jobs

Treyarch

Playa Vista, California
6.20.22
Audio Engineer

Digital Extremes

London, Ontario, Canada
6.20.22
Communications Director

High Moon Studios

Carlsbad, California
6.20.22
Senior Producer

Build a Rocket Boy Games

Edinburgh, Scotland
6.20.22
Lead UI Programmer
More Jobs   

CONNECT WITH US

Register for a
Subscribe to
Follow us

Game Developer Account

Game Developer Newsletter

@gamedevdotcom

Register for a

Game Developer Account

Gain full access to resources (events, white paper, webinars, reports, etc)
Single sign-on to all Informa products

Register
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more