Interaction Engine

Nicholas Benson edited this page Jul 10, 2017 · 19 revisions


The Interaction Engine allows users to work with your VR application by interacting with physical or pseudo-physical objects. Whether a baseball, a block, a virtual trackball, a button on an interface panel, or a hologram with more complex affordances, if there are objects in your application you need your user to be able to hover near, touch, or grasp in some way, the Interaction Engine can do some or all of that work for you.

You can find latest stable Interaction Engine package on our developer site.

If you take a look at the examples that come with the package, you'll notice some common patterns that are good to follow when building things with the Interaction Engine.

The Basic Components of Interaction

  • "Interaction objects" are GameObjects with an attached Interaction Behaviour. They require a Rigidbody and at least one Collider.
  • The Interaction Manager receives FixedUpdate from Unity and handles all the internal logic that makes interactions possible, including updating hand/controller data and interaction object data. You need one of these in your scene for interaction objects to function! A good place for it is right underneath your player's top-level camera rig object (not the camera itself, but its parent).
  • Interaction Controllers do all the actual interacting with interaction objects, whether by picking them up, touching them, hitting them, or just being near them. This object could be the user's hand by way of the Interaction Hand component, or a VR Controller if it uses the Interaction VR Controller component. Interaction controllers should sit beneath the Interaction Manager in the hierarchy -- see the diagram below.

Interaction objects may or may not live inside the player's camera rig depending on whether or not they should move with the player. Interaction controllers, including Interaction Hands, always live underneath the Interaction Manager, and the Interaction Manager should be a sibling of the camera object.

Physical by Default

When you add an InteractionBehaviour component to an object, a couple of things happen automatically:

  • If it didn't have one before, the object will gain a Rigidbody component with gravity enabled, making it a physically-simulated object governed by Unity's PhysX engine. If your object doesn't have a Collider, it will fall through the floor!
  • Assuming you have an Interaction Manager with one or more interaction controllers beneath it, you'll be able to pick up, poke, and smack the object with your hands or VR controller.

The first example in the Interaction Engine package showcases the default behavior of a handful of different objects when they first become interaction objects.

Get your Hands Dirty

When you're ready to begin building your VR application with the Interaction Engine, these documents will be helpful:

  • Getting Started, a guide that will show you the basics and what's possible with the Interaction Engine, through the examples that come with the package.

  • Scripting Interaction Objects, a basic primer for working with PhysX objects in Unity and examples for scripting common behaviors.

  • Interactions In-Depth, a deeper look at the fundamental interaction types supported by the Interaction Engine (hover, contact, grasping) and what you need to know if you're looking to customize their behavior for your application.