Skip to content

Introduction to Interactable Objects

STimberlake edited this page May 27, 2021 · 1 revision

Introduction to Interactable Objects

In XR applications, users want to pick up and manipulate objects using controllers and/or hand tracking. Interactable Objects are a common design element across XR applications, and they are the core of VSDK's interaction system.

This guide describes the design of Interactable Objects and how the design is realized in VSDK Unreal Edition. A tutorial on creating an Interactable Object is also available.

Actions

Interactions with objects are most frequently defined by three types of actions:

  • Select. An object reacts to a user selecting it. (e.g. When touched, an object is visually highlighted to indicate that it is grabbable.)

  • Grab. An object reacts to a user grasping or picking it up. (Almost any object in a VR game can be picked up and tossed.)

  • Use. An object reacts to a trigger press by a user (e.g. a gun shoots, a drill turns on)

Implementation

At a high level, VSDK Unreal uses a Blueprint-extensible base class for interactable objects as well as component classes that drive specific touch, grab, and use behavior. Default components can be used for quick prototyping; deep customization can create advanced interactions.

Interactable Object Class

Interactable Objects are implemented in the C++ class AInteractableObject, which is an Actor. However, for most applications, we recommend creating a Blueprint class that extends BP_SimpleInteractableObject.

Subcomponents

Most behaviors of Interactable Objects are defined in the subcomponents. There five subcomponents in the initial hierarchy of an Interactable Object are described below.

Static Mesh

The Static Mesh represents the visuals and physics of the object. When creating objects, the best practice is to separate visuals from physics.

To separate visuals from physics for an Interactable Object:

  1. Set up your collision mesh in the Static Mesh field.
  2. Set Visible to false in the mesh’s rendering settings.
  3. Add a second mesh as a child, contains thing visual representation of your object.
  4. Disable collision on the second mesh.

Grab Handle

This subcomponent indicates where the object will be grabbed from.

Select

This subcomponent determines what actions trigger the events OnSelect and OnDeSelect.

Objects in XR applications are usually selected by touch. However, VSDK’s flexibility enables you to develop alternate modes of selection. For example, distant interactable objects could be selected using a laser pointer.

Grab

The Grab Component generates two events, OnGrab and OnUnGrab, that determine what occurs when the object is grabbed and released.

Options for the Grab Component are listed under VSDK in the Details panel:

  • GrabAttach determines how the object will be grabbed. ChildGrabAttach, which childs the interactable object to the Grabber that grabbed it, is the most common setting, while Controllables use a few of the other options (Controllables represent items like levers, dials, and buttons, and so have custom movement requirements; more detail on Controllables will be posted to the wiki soon.) Additionally, you can extend the C++ base class to define your own grab behaviors.
  • PrecisionGrab determines whether or not the Grab Handle will be used. If PrecisionGrab is set to true, the object will attach at the grab collision point; otherwise the Grab Handle will be used.
  • MultiGrabAttachment determines how the object will respond to a second hand grabbing it. For example, DirectionalGrabAttach will let the user aim the object with their second hand.

Use

The Use Component triggers Use and StopUse events. The Use Component has a single option: UseAction. The default setting for UseAction does not trigger events; in order for events to be triggered by the use of the object, you must change the default setting from 'None' to 'UseAction'.

Additional UseActions can be created to abstract common behaviors for reuse across multiple interaction objects. For example, you can create a UseAction that handles changing a material or triggering particle effects.