Interaction Engine

Caleb Kruse edited this page Jun 7, 2017 · 18 revisions

Introduction

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 Behaviour: Requires a Rigidbody and a Collider. This is an object the user can interact with. You'll see this referred to as an "interaction object". It just means a GameObject with an InteractionBehaviour attached to it.
  • Interaction Manager: This object receives FixedUpdate from Unity and then 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 (the object you would move if you were to translate your player character).
  • Interaction Controller: Interaction controllers are anything that interacts with interaction objects, whether by picking them up, touching them, hitting them, or just being near them. Technically speaking, this is an abstract type that can either actually be the user's hand via the Interaction Hand component or a VR Controller via the Interaction VR Controller component, each of which should sit beneath the Interaction Manager in the hierarchy.

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.