VR Grabbable Unity Setup -> Grasp Resource (Storyflow)
In depth learning on Scene Configuration can be found in this course in Motive Academy.
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
Step 1: 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
Play the Scene
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.
Step 2: 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
Step 3: 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
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
Step 4: 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 + icon 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 Event Link Shortcut (the blue "+" button) and select complete
In the newly created Frame, drag and drop in a Notification Resource (Playable Content)
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
Step 5: 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.
Related Articles