Overview
This article shows how to:
Make a Unity object grabbable in VR using the SDK
A simple example of using Grab Anchors
Make the Unity Object recognizable in a Storyflow script using a Motive Scene Object
Add a reference to the object in a Storyflow Catalog
Create a test Storyflow script which uses the Object Interaction → Grasp Resource
Run the test Storyflow script and verify that the Unity object configuration was done correctly
Unity SDK - VR Grabbable
In the Hierarchy, find the object you wish to make grabbable. We use the brush in this case. It can be any object.
Right click on the object. Select Motive -> Make Grabbable
In the Inspector, notice that three components have been added to the object.
A Rigidbody
A Mesh Collider
VR Grabbable script
Make the Mesh Collider = Convex.
Save the scene and play it
Pick up the brush. Notice that the brush can be picked up from any point. Specific grab points can be defined in the VR Grabbable script.
Optional: Add a grab anchor to the handle. A grab anchor is a transform. You can use the buttons to define a grab anchor for either hand or you can create your own and assign it.
Optional: Options for release behavior, distance grabs and more can be configured in the VR Grabbable script component.
The object is now able to be picked up in VR. You can configure the specific behavior based on your use case.
Unity SDK - Motive Scene Object
To be usable with Storyflow, add a Motive Scene Object script and give it a name.
Right click on the object. Select Motive -> Make Scene Object.
In the name field, type a name.
Remember this name. A catalog item with the same name will need to be created in a Storyflow Catalog.
For this example, the name will be 'Brush'.
Save the scene.
At this point, everything that is needed has been configured in Unity.
Storyflow - Named Object Catalog Item
In Storyflow, go to the Catalogs tab and find a Named Object catalog.
If one does not exist, create one.
Add an item to the catalog.
Select the item and give it the same name that was given to the Motive Scene Object.
In this case, the name is Brush.
Save the catalog.
Storyflow - Create a Test Script
Go to the Scenarios tab.
Create a new script called Test Grasp - VR Grabbable.
Open the script to edit.
Add a Scene Object resource.
Click the '+' button on the Object field.
Select the object you added to the catalog.
The example used the name ‘Brush’
Add a frame.
Drag in the Grasp Resource and select the object ('Brush') from the World Object drop down menu.
Click the blue "+" button and select 'complete'.
In the newly created frame, add a Playable Content -> Notification.
Enter some text in the Message field.
Optional: Give the Notification a sound or an image if you'd like.
Save the script. When this script is run in the VR scene, it will wait until the object (Brush) is picked up.
When it is, the Notification will display.
Click the Project tab.
Assign the Test Grasp - VR Grabbable script to a scenario. If no scenario exists, create one.
Save the scenario.
Unity - Run the Test Script
In Unity, play the scene and select the scenario.
Pick up the object (Brush).
Notice that the notification shows once it is picked up.
At this point, the Unity object is configured to be grabbable in VR, made recognizable in Storyflow, used in a script and triggered a notification after the appropriate action was taken.