Overview
This article describes how you can implement Motive’s premade Sliding Joint component to connect 3D assets and have them interact as if they were connected on rails. With only a few minor changes made in Unity, this functionality allows for easy and fast interaction that can be used in conjunction with other Motive premade features such as, VR Attachable, VR Attachable Receiver and VR Grabbable.
Setup - Unity SDK
Open your Unity project and in the scene Hierarchy window find “World”
Right-click on World then select (Create Empty) and name your new empty object “Slide Remove Example”
In your Slide Remove Example Inspector window select (Add Component > (Type in “Rigidbody”) > Rigidbody)
Toggle Use Gravity to off
Toggles Is Kinematic to on
Right-click on Slide Remove Example and make a child object by selecting (3D Object > Cube)
Name this cube “Stationary Cube”
In the Stationary Cube Inspector window under the Box Collider component toggle Is Trigger to on
Next, add a Rigidbody to the Stationary Cube as you did before
Once again you need to toggle Use Gravity to off and Is Kinematic to on
Right-click on Stationary Cube and make a child object by selecting (Create Empty)
Name this object “Sliding Joint”
Right-click on the Sliding Joint and select (Motive > Joints > Add Sliding Joint)
In the Rigidbody component disable Use Gravity
In the Sliding Joint component click on the box next to Connected Rigidbody and delete that object
Into that same box drag the Slide Remove Example object you just made
Next, in the same component toggle Limit Motion to true
Then in the box beside Upper Limit type 0.1
Right-click on Sliding Joint and select (Motive > Make Attach Receiver)
Scroll down to the new Attach Receiver component expand the Colliders dropdown and expand the Size to 1
In the new Element 0 area drag in Stationary Cube
Right-click on Sliding Joint and make a child object by selecting (Create Empty)
Name this object “Removable Part”
Right-click on the Removable Par and select (Motive > Make Grabbable)
In the VR Grabbable component toggle Track Orientation to off
Find the Box Collider component and select the *Three dots* on the top right of the component, then select Remove Component
Under the VR Attachable component expand the Attached Grab Settings dropdown then select the Release Behaviour dropdown and then click on Leave in Place
Then in the same Attached Grab Settings dropdown change the Move Mode to Physics
While you are still in the VR Attachable component scroll down to find the Attached To field, and delete whatever object is in that box
Then slightly lower you can toggle Requires Detachable to on
Next, expand the Guide Meshes dropdown and increase Size to one
Right-click on Removable Part and select (Motive > Joints > Add Fixed Joint)
Right-click on Removable Part again and select (3D Object > Cube)
Name this cube “Sliding Cube”
Go back to Removable Part now under the VR Attachable find Element 0 under the Guide Meshes dropdown
Drag Sliding Cube into the box beside Element 0
Now, go back to Sliding Joint and under the Sliding Joint component in the Upper Stop dropdown menu, you need to hit the + icon under In Limit ()
Then, you need to drag Removable Part into the box that reads None
From there select the No Function dropdown menu and select (VR Attachable > SetDetachable ())
Next, you must select the Slide Remove Example object and either using the *Arrow* shown in the Scene view or the Position values under the Transform component you just move the object somewhere easily accessible in the Workshop scene
(X: 1.588, Y: 0.448, Z: 2.139 works well)
After, that it would be best to reduce the Slide Remove Example Scale to 0.5 on both the X, Y and Z axis, these values can also be found under the Transform component
Then select Sliding Cube in the Hierarchy window and change its scale values to 0.3
Then, using the *Arrows* as mentioned before or the Position fields under the Transform component you should move Sliding Cube so it is visible
These position values work well (X: 0, Y: 0.62, Z: 0)
Save the scene
Setup - Storyflow
Open Storyflow and select the Catalogs tab
If you do not have a “Named Anchor” catalog already, select (Create > Select Type > Named Anchor > (Type a name) > Create)
Open your “Named Anchor“ catalog then select (+ > Named Anchor > (Type in “Anchor1”) > Save)
Save the catalog
Open the Scenarios tab and select (+ Add a New Script > (Type a name) >
Checkmark > (Newly Created Script))Under Resources on the right side of the screen click and drag the “Scene Anchor” resource into
the grey area in the center of the screenSelect (Anchor + > (Your Named Object catalog) > Anchor1 > Save
In the same grey area mentioned before put the Guide “Screen Message” resource there
“Screen Message” can be typed into the Resource search bar for easy access
Select the drop-down menu under Anchors and select Anchor1
Under Text type “Great work”
Select Save on the top left of the screen
Next, select the Project tab on the top of your screen then go (Create > Script + >
[Project name] Scripts > (Your new script) > Title > (Type a new scenario title) >
Save)
You can now open your Unity project select the newly created scenario, and see your newly made notification!