Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
panelIconId1f393
panelIcon:mortar_board:
panelIconText🎓
bgColor#4C9AFF

In depth learning on Scene Configuration can be found in this course in Motive Academy.

Overview

This article describes how you can implement Motive’s premade Sliding Joint component to connect 3D assets 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. After that, we will cover how we can check object states related to sliding objects in order to trigger events on Storyflow.

...

Table of Contents
minLevel1
maxLevel6
outlinefalse
typelist
printablefalse

Setup - Unity SDK

  1. Open your Unity project and in the scene Hierarchy window select

...

  1. World > Example Assets > Props > Workbench > Workbench_LOD0 > Bench Top

...

  1. Under the Mesh Collider component turn Is Trigger to off

  2. Scroll down to the bottom of the Inspector window and select

...

  1. Add Component > (Type in “Rigidbody”) > Rigidbody

...

  1. In the Rigidbody component toggle Use Gravity to off

...

  1. Toggle Is Kinematic to on

  2. Then in the Hierarchy window select

...

  1. World > Example Assets > Props > Workbench > Stud > Stud

...

  1. In the Rigidbody component toggle Use Gravity to off

...

  1. Toggle Is Kinematic to on

...

  1. Set your Collision Detection to Discrete

  2. In the Mesh Collider component, toggle Is Trigger to off

  3. Right-click on Stud in the Hierarchy window and select

...

  1. Motive > Make Grabbable

...

  1. Scroll down to the new Mesh Collider component and delete it by selecting the *Three dots* on the top right of the component, then select Remove Component

  2. In the new VR Grabbale component, make sure that Allow Distance Grab is toggled off

  3. In the Snap Position and Snap Orientation dropdown menus, make sure both values are set to

...

  1. “Never”

  2. Toggle Track Orientation to off

  3. Set Release Behaviour to Leave In Place

  4. Then change Move Mode to Physics

  5. While you are still in the Stud Inspector window scroll down to the bottom and select

...

  1. Add Component > (Type in “String State Setter”) > String State Setter

...

  1. In the State textbox type

...

  1. Plank Position

  2. Back in the Hierarchy window right-click on Stud and select

...

  1. Motive > Joints > Add Sliding Joint

...

  1. In the new Sliding Joint component under Axis change the X value to 0 and set the Y value to 1

  2. Under Secondary Axis set the X value to 1 and the Y value to 0

  3. Next, select the *Target* icon for the Connected Rigidbody area and then select Bench Top

  4. Then, toggle Limit Motion to On

  5. In the Lower Limit text area type

...

  1. as -0.

...

  1. 2 and for the Upper Limit type

...

  1. as 0.

...

  1. 4

  2. Expand the Upper Stop dropdown menu and

...

  1. Under Limit Threshold type

...

  1. 0.

...

  1. 2

  2. Next in the In Limit() area hit the + icon then drag Stud from your Hierarchy window into the box that reads None (Object)

  3. Then, expand the No Function dropdown menu and select

...

  1. StringStateSetter > SetState (String)

...

  1. In the *Newly Created Textbox* type

...

  1. Outside

  2. Expand the Lower Stop dropdown menu and under Limit Threshold type

...

  1. to 0.

...

  1. 1

  2. Next in the In Limit() area hit the + icon then drag Stud from your Hierarchy window into the box that reads None (Object)

  3. Then, expand the No Function dropdown menu and select

...

  1. StringStateSetter > SetState (String

...

  1. )

  2. In the *Newly Created Textbox* type

...

  1. Inside

  2. Save the

...

  1. Scene

Setup - Storyflow

...

Create the Enum

  1. Select the *Three Bullet List* icon on the right side of the screen (Reference Image Below)

    Image Modified
  2. Next, select New Enum Name and type

...

  1. Plank Position

  2. After that, hit the > left of where it reads Plank Position and then select New Enum Item Name then type

...

  1. Inside

  2. Do this a second time but type

...

  1. Outside

Set up the Catalog

  1. Open Storyflow and select the Catalogs tab

  2. If you do not have a “Named Object”

...

  1. Catalog already, select

...

  1. Create > Select Type > Named Object > (Type a name) > Create

...

  1. Open your “Named Object“

...

  1. Catalog then select

...

  1. + > Named Anchor > (Type in “Stud”) > Save

...

  1. Save the

...

  1. Catalog

  2. If you do not have a “Behaviour Model”

...

  1. Catalog already, select

...

  1. Create > Select Type > Behaviour Model > (Type a name) > Create

...

  1. Open your “Behaviour Mode“

...

  1. Catalog then select

...

  1. + > Behaviour Model > (Type in “Stud Behaviour Model”)

...

  1. Then select

...

  1. States + > (Type in

...

  1. Plank Position)

...

  1. Expand the Primitive dropdown menu and change it to Enum

  2. After that, expand the NOT SET dropdown menu and select Plank Position

  3. Save the

...

  1. Catalog

Scripting

...

  1. Open the Scenarios tab and

...

  1. Create a New Script

...

  1. Open the new Script

  2. Under Resources on the right side of the screen click and drag the

...

  1. Scene Object Resource into
    the grey area in the center of the screen

  2. Select

...

  1. Object + > (Your Named Object catalog) > Stud

...

  1. In the same grey area mentioned before

...

  1. , drag and drop in the Behaviour Model Resource

  2. Select

...

  1. Targets + > Stud

...

  1. Then, select

...

  1. Behaviour Model > (Your Behaviour Model catalog) > Stud Behaviour Model

...

  1. Select the +

...

  1. icon attached to the “Main Frame” on the left side of the screen to create a new Frame

  2. Select the newly created

...

  1. Frame and in the same grey area mentioned before

...

  1. , drag and drop in the

...

  1. Set Object State Resource

  2. Select

...

  1. World Objects + > Stud

...

  1. Then, select

...

  1. Behaviour Model > (Your Behaviour Model catalog) > Stud Behaviour Model

...

  1. Select

...

  1. CHOOSE STATE > Plank Position > Compare +

...

  1. In the new Value dropdown list select Outside

  2. Next, select the blue + icon on the bottom right of the Set Object State resource, scroll down the list that appears and select Close

    1. In the newly created frame, add the

...

    1. Notification Resource and under Message type

...

    1. Outside

  1. Again, select the +

...

  1. icon attached to the

...

  1. Main Frame on the left side of the screen

  2. Select the newly created

...

  1. Frame and in the same grey area mentioned before

...

  1. , drag and drop in the

...

  1. Set Object State Resource

  2. Select

...

  1. World Objects + > Stud

...

  1. Then, select

...

  1. Behaviour Model > (Your Behaviour Model catalog) > Stud Behaviour Model

...

  1. Select

...

  1. CHOOSE STATE > Plank Position > Compare +

...

  1. In the new Value dropdown list select Inside

  2. Next, select the blue + icon on the bottom right of the Set Object State resource, scroll down the list that appears and select Close

  3. In the newly created

...

  1. Frame, add the

...

  1. Notification Resource and under Message type

...

  1. Inside

  2. 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)

  1. Create a Scenario, if there isn’t one already

  2. Link the Script you created to the Scenario

You can now open your Unity project select Project. Select the newly created scenarioScenario, once it has loaded you should be able to grasp the Stud from the workbench, slide it to the left, and read your new notifications!Notifications!

Related Articles