Driving a Car in VR, Part I
Using XRI Examples package in Unity to make an interactable car model
Today, an immersive gaming experience is an expensive prospect. To get immersed in the game, and have it feel as close to real life as possible, gamers would have to spend hundreds (if not thousands) of dollars on a setup with multiple monitors, a wheel or yoke, and a seat. Very few people have the resources to build a car sim or flight sim rig, for example, though VR is quickly becoming an alternative.
There are many games on the market with VR support, like Microsoft Flight Simulator (2020) and DCS World, but they rely on external controllers like joysticks or wheels which can decrease immersion in a VR space. As far as I know, today, there are not many VR driving or flying games that are designed for full VR control. I believe that having a player interact with the movable objects in-game (like a yoke in a flight sim) rather than with a physical interface device (like a joystick), will make the experience feel more immersive.

Currently, VR is being used as an alternative to traditional displays and monitors. Headsets are being used to create a 360 degree screen in front of your eyes–but VR can be so much more. What makes VR great is interactivity. Interacting with the environment around you in a virtual space is what makes it feel real. The greatest VR experiences so far, like Half Life Alyx, use interactivity to their advantage.
Seeing this misuse of VR technology, there is a big opportunity to make it better. I set myself the goal of making a car that could be steered using only inputs from XR controllers. I chose a car as a test-bed because there are no VR driving games (that I can think of) that use the XR controllers to interact with the control surfaces of the vehicle.
To save me time, I used a car model that I had purchased previously from CGAxis. To make this existing model interactable, I used two tools that were part of the XR Interaction Toolkit package for Unity, the XRKnob and XRLever scripts. The process from start to finish was relatively simple.Â
I took the XRKnob script, and attached it to a steering wheel model that was part of the car already. Then I created a simple script that then takes the rotational movement of the lever attached to the wheel and translates that into the steering movement of the car. In the same script, I created a method to accelerate the car with the triggers of the controllers. I also used the XRLever script to switch movement direct of the car.
Here’s a short demo of the experience.Â
This project is far from complete and is a bit rough around the edges, but the core experience is still there. My next steps will be refining the control surfaces of the car to have more realistic inputs and animations. I plan on sharing my completed project as a demo once it is complete.
Stay tuned for Part II and other projects on this blog!