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 (World > Example Assets > Props > Workbench > Workbench_LOD0 > Bench Top)

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

  3. Scroll down to the bottom of the Inspector window and select (Add Component > (Type in “Rigidbody”) > Rigidbody)

  4. In the Rigidbody component toggle Use Gravity to off and toggle Is Kinematic to on

  5. Then in the Hierarchy window select (World > Example Assets > Props > Workbench > Stud > Stud)

  6. In the Rigidbody component toggle Use Gravity to off and toggle Is Kinematic to on. After that set your Collision Detection to Discrete

  7. In the Mesh Collider component toggle Is Trigger to off

  8. Right-click on Stud in the Hierarchy window and select (Motive > Make Grabbable)

  9. 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

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

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

  12. Toggle Track Orientation to off

  13. Set Release Behaviour to Leave In Place

  14. Then change Move Mode to Physics

  15. While you are still in the Stud Inspector window scroll down to the bottom and select (Add Component > (Type in “String State Setter”) > String State Setter)

  16. In the State textbox type “Plank Position”

  17. Back in the Hierarchy window right-click on Stud and select (Motive > Joints > Add Sliding Joint)

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

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

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

  21. Then, toggle Limit Motion to On

  22. In the Lower Limit text area type “-0.2” and for the Upper Limit type “0.4”

  23. Expand the Upper Stop dropdown menu and under Limit Threshold type “0.2”

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

  25. Then, expand the No Function dropdown menu and select (StringStateSetter > SetState (String))

  26. In the *Newly Created Textbox* type “Outside”

  27. Expand the Lower Stop dropdown menu and under Limit Threshold type “0.1”

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

  29. Then, expand the No Function dropdown menu and select (StringStateSetter > SetState (String))

  30. In the *Newly Created Textbox* type “Inside”

  31. Save the scene

Setup - Storyflow

  1. Open Storyflow and select the Catalogs tab

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

    Image Modified
  3. Next, select New Enum Name and type “Plank Position”

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

  5. Do this a second time but type “Outside”

  6. If you do not have a “Named Object” catalog already, select (Create > Select Type > Named Object > (Type a name) > Create)

  7. Open your “Named Object“ catalog then select (+ > Named Anchor > (Type in “Stud”) > Save)

  8. Save the catalog

  9. If you do not have a “Behaviour Model” catalog already, select (Create > Select Type > Behaviour Model > (Type a name) > Create)

  10. Open your “Behaviour Mode“ catalog then select (+ > Behaviour Model > (Type in “Stud Behaviour Model”))

  11. Then select (States + > (Type in “Plank Position”))

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

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

  14. Save the catalog

  15. Open the Scenarios tab and select (+ Add a New Script > (Type a name) >
    Checkmark > (Newly Created Script))

  16. Under Resources on the right side of the screen click and drag the “Scene Object” resource into
    the grey area in the center of the screen

  17. Select (Object + > (Your Named Object catalog) > Stud)

  18. In the same grey area mentioned before put the “Behaviour Model” resource there

  19. Select (Targets + > Stud)

  20. Then, select (Behaviour Model > (Your Behaviour Model catalog) > Stud Behaviour Model)

  21. Select the + sign attached to the “Main Frame” on the left side of the screen

  22. Select the newly created frame and in the same grey area mentioned before put the
    “Set Object State” resource there

  23. Select (World Objects + > Stud)

  24. Then, select (Behaviour Model > (Your Behaviour Model catalog) > Stud Behaviour Model)

  25. Select (CHOOSE STATE > Plank Position > Compare +)

  26. In the new Value dropdown list select Outside

  27. 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 “Notification” resource and under Message type “Outside”

  28. Again, select the + sign attached to the “Main Frame” on the left side of the screen

  29. Select the newly created frame and in the same grey area mentioned before put the
    “Set Object State” resource there

  30. Select (World Objects + > Stud)

  31. Then, select (Behaviour Model > (Your Behaviour Model catalog) > Stud Behaviour Model)

  32. Select (CHOOSE STATE > Plank Position > Compare +)

  33. In the new Value dropdown list select Inside

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

  35. In the newly created frame add the “Notification” resource and under Message type “Inside”

  36. Select Save on the top left of the screen

  37. 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, 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