At my school we are currently having a four week VR game project. My group have chosen to make an atmospheric horror escape room game where you play as a kid trying to escape from the monster in the closet. In this  post I’m going to talk about my system and implementation for picking up items and objects in the game and interacting with them. We are using Unreal Engine in this project and hence we are using the Blueprint scripting language for almost all scripting.

In my team we are three designers. I have a lot of experience with coding and programing but my teammates are less inclined to do the heavy lifting in the scripting department. Therefore it was natural that I was selected to be the lead programmer for this project.

The first thing I would like to write about is how I solved the problem of picking things up and interacting with them in VR.

The goals

I would like to have interaction with objects within our game to feel similar to the interaction in Job Simulator.

First approach

The first simple approach to implement picking things up in VR is to attach the actor that you would like to pick up to the motion controls themselves. Then when you move the motion controls you move the actors as well.

The problem with this approach is that it messes up physics quite a bit. The motion controls themselves actually teleport themselves and since the game can’t stop the player to physically move their hands, the game must allow the player to move their hands through and within objects. The attached actor may then clip through other objects within the game. This could break the immersion for the player but also introduce lots of game design problems as well. For example the player can reach into a locked vault and pull stuff out. Also we introduce physics problems as well since the player then can move items within each other which causes all sorts of problems for the physics engine in Unreal.

I needed to find another way.

Second approach

The second approach I decided to try was to fully take advantage of the physics engine in Unreal. Make the engine do all the heavy lifting for me when it comes to collision and physics. When I researched my options I stumbled onto this video  that demonstrates physics handles in Unreal.

Physics handles in Unreal are a way of moving physics objects around, it’s precisely what I need! It works like this: You specify to the physics handle the component you would like to grab and where you would like to grab it. Then the physics handle “pinches” the object and holds it in place. When you move the physics handle it moves the “pinched” object along with it. Fully simulated by the physics engine! I experimented with this for a while and ended up with the following solution for moving items:

  1. Find the location where the player hold their hand on the object
  2. “Pinch” the object with a physics handle at that location
  3. Move the physics handle every frame alongside the motion control
  4. Release the “pinch” when the player drops the object

This resulted in much better feeling interaction with objects. The objects behave really well when colliding with other physical objects and it keeps clipping to a minimum. The implementation may still need some fine tuning but will work for now!

Drawers and more…

I tried the same approach when I tried to implement other objects that the player could interact with. The first of these was a drawer. I used a physics handle to “pull” the drawer along a physical constraint track. This resulted in some smooth drawers!

I think that the combination of physics handles and physical constraints can be a powerful solution for future implementation of for example levers, buttons, strearing wheels etc.

I hope soneone will find this intresting! Next time I will probably write about the interface connecting the hands with the interactable objects.

Best regards!

Simon Engqvist