Interactive Objects Guide

HTC ©2017 – Version 1.1

Interaction types

There are currently 6 types of interactions:

  • *Pick up* and *throw* – When the user pulls the trigger while touching an object.
  • *Touch* – When the user’s controller collides with the object.
  • *Click* – When the user points at an object and pulls the trigger.
  • *Pointer Enter* – When the user’s pointer intersects the object, repeats if the users points away and then points at the object again.
  • *Impact* – When a non-controller collider collides with an object that has a rigidbody attached.
  • *Object* – When another specific interactive object collides with an object

Initial setup

Any GameObject can be setup for interactivity, including static objects. To perform the initial setup for an Interactive object in your VR Preview, do the following:

  1. Add an appropriate collider to the object. This will be used for both physical interactions, such as “Touch,” and event interactions such as “Click” and “Hover”.
  2. Make sure the collider is Not set as a trigger collider.
  3. Add the ViveObjectProps component to the game object. The component should be added to the top of the object’s hierarchy, above any of its meshes.

Interactive Object Highlighting

Any meshes in the hierarchy below the game object with the ViveObjectProps component will be automatically highlighted so that the user knows that they can interact with the object. This is done by adding a highlighter material at run-time.

Pickup/Throwable Objects

If you want to have an Interactive object that can be picked up and thrown, you will need to do the following:

  1. Check the ‘Pick up item’ flag on the gameobject with the ViveObjectProps on it.
  2. Attach a rigidbody (or already have one attached) to the gameobject with the ViveObjectProps on it, and assign it to the “Body” property. To assign the body property, do either of the following:
    1. Click and drag the Rigidbody component into the property slot next to “Body”
    2. Click on the target next to the “Body” property, and select the correct rigidbody object from the list.
    3. If you already added a rigidbody to the object before adding the ViveObjectprops, it will be automatically assigned.
  3. Ensure that the rigidbody is NOT set as Kinematic.
    1. To do this, make sure the “IsKinematic” flag on the rigidbody component is unchecked. It is set unchecked by default, so this is mainly relevant if you are copying and modifying existing game contents into Vive Objects.

Immobile Interactive Objects

If you want an object that is interactive, but doesn’t move, simply don’t supply a rigidbody on the object. An object like this cannot be picked up and thrown.

Adding interactions

To add specific interactions to an object, do the following:

  1. For the desired interaction click the appropriate “Add Touch/Click/Pointer Enter/Impact Interaction” button on the ViveObjectProps component (fig. 1).

  2. You need at least 1 of either an audio clip or animation to play, although it is recommended to have both.

    1. If you do not add an audio source, a default will be provided at runtime. If you want more control, it is recommended to add one yourself and configure it to your liking.
      1. If you wish to have the audio mixer group be assigned to one of our mixer channels, you can add the optional PreviewAudioContext to the Interactive object, and select one of the available mixing group keys to bind to.
      2. For more information on audio configuration, see the Audio Setup guide below.
    2. If you do not already have an Animator Component on the interactive object, one will be setup automatically during load. Regardless of your controller setup, our system will override and play interaction animations using the Playables API (may change in the future).
  3. If you change your mind about an interaction, you can click the appropriate “Remove Touch/Click/Pointer Interaction” and the audio/animation slots for that interaction will be hidden (the fields will also be cleared).

    _images/scenesdk_image13.png

Figure 1. An example of an interactive object with a touch interaction, a click interaction, and an impact interaction. Note the configuration of rigidbody and collider components.