Skip to main content

Playable Demo

The playable demo is a small set of scenes that shows what you can build with HRI-MobiSim. You start in a hub, walk through a gate into a room, try an example, and come back to the hub to pick the next one. Each room covers one part of the simulator: AI road agents, dialogue, a complete mobility scenario, and two assessments.

All of these scenes are included with HRI-MobiSim. You can open them in Unity, press Play, and see exactly how each example works. The objects, components, and events you inspect in the Editor are the same ones running in your browser.

What You'll Learn​

This page takes you through those scenes one at a time. It doesn't cover every feature in depth, because each section links to the manual page that does. Instead, it shows how the pieces fit together in a working project. By the end, you should be able to:

  • Follow how the hub, the rooms, and the Scene Graph connect into a single flow.
  • Find the objects behind an interaction and trace its events in the Inspector.
  • Recognize patterns you can reuse in your own scenario, such as trigger areas that start road agents, dialogue started by an interaction or a Timeline, and assessments that end the scene when they're finished.
Experiment safely

Duplicate a scene before you change anything in it. The original then stays available as a reference you can compare against. If your project uses version control such as Git, commit your work before you experiment, so you can always roll back to a working state.

Getting Started​

The demo scenes are in Assets/mobisim/Scenes/Scenes/Demo Scenes. The order they load in is defined by a single scene graph asset, Assets/mobisim/Scenes/Graph/Demo Scene Graph.asset.

1
Open the scene and graph

After installing the simulator, open Demo Hub Scene from the demo scenes folder. Then double-click Demo Scene Graph in the graph folder to open it in the SceneGraph window. Keep this window open while you explore the Hierarchy and Inspector, because you'll return to it whenever you follow how one scene leads to the next.

2
Select the scene graph

To play the demo in the Editor the same way it runs in the browser, the simulator needs to know which scene graph to follow. Open Edit > Project Settings > mobisim > Scene Graph and select Demo Scene Graph for the platform you're testing. See Scene Graph settings to learn more about choosing the active graph.

3
Play the demo in the Editor

Start through the simulator's Initialization and bootstrap setup, then enter Play mode and click the Game view to give it keyboard and mouse focus.

You start in the hub. Walk through a gate to enter a room, and finish the room to return to the hub. The room names and exhibit signs you see while playing match the section names on this page, so you can easily find the setup behind each one.

The bootstrap step creates the GameInstance, the object that moves through the graph from one scene to the next. You can also open a room scene directly to inspect its objects, but without the bootstrap you won't get the navigation between the hub and the rooms.

Demo Hub Map​

The map below follows the hub's floor plan. Each room sits in the direction of its gate and uses the same color. Click a room to show its walkthrough below the map, or click Demo Hub in the center to see how the hub and scene graph work. If this is your first time, start with the hub: the room walkthroughs build on it.

Two examples, Remote Control and VR Example, aren't part of the browser demo. They're separate sample scenes included in the project, and you'll find them in the Standalone examples group.

Demo Hub↑ Hub map

Demo Hub​

Demo Hub in the Game view showing the five room gates and their signs

Open Demo Hub Scene. The hub is the first scene in Demo Scene Graph, and it works like a menu you can walk around in. Each of its five gates leads to an example room. When you finish a room, you come back here to choose another.

How the Scenes Connect​

Going from the hub to a room happens in two separate steps:

  1. Choosing a room. Walking through a gate stores your choice as a number in a shared integer variable.
  2. Leaving the scene. When the hub finishes, the scene graph reads that number and loads the matching room.

Because these steps are separate, a gate never needs to know which scene it leads to. The graph makes that decision.

The map above shows the hub's layout, not the scene graph itself. To see the actual flow, look at Demo Scene Graph in the SceneGraph window:

Demo Scene Graph in Unity showing the hub, selection variable, Cast, Switch, and return connections

  • Start leads to the hub.
  • The hub's Out port leads to a Switch node, which picks one of the five rooms.
  • Every room's Out port leads back to the hub's In port.

A Scene node waits until its scene finishes before it follows its outgoing connection.

The Switch gets its selection from two helper nodes. Select the Int Variable node and you'll see that it references SampleLevelSelectVariable, the variable the gates write to. The Cast node converts that integer to a string, because Switch.Selection expects a string. Compare the Switch's output labels with the gates in the hub:

Gate in the Hub HierarchySelectionDestination
Conversation Room Gate1Conversation Demo Scene
Agent Room Gate2Agent Demo Scene
Stroop Test Room Gate3Stroop Test Demo Scene
Survey Room Gate4Survey Assessment Demo Scene
Mobililty Room GateDefault routeMobility Scenario Demo Scene

Mobility doesn't have a numbered output of its own. It uses the Switch's Default route, which is taken whenever the selection isn't 1 through 4.

note

Mobililty is spelled the way it is in the project, so search for it as written.

Follow a Gate's Interaction​

Now look at how a gate records your choice. Select Conversation Room Gate in the hub's Hierarchy. It's an instance of Interactable Components Prefab. In its Interactable component, expand Options and find the Enter option. It lasts one second and completes on its own when that time is up.

When the option completes, its Interact Event Complete runs two listeners, in this order:

  1. Set SampleLevelSelectVariable.RuntimeValue to 1.
  2. Call GameMode.EndSession on the scene's GameMode Prefab.

Conversation Room Gate Inspector showing the Enter option and its two completion listeners in order

The first listener records the choice, and the second tells the simulator that the hub is done. GameMode passes that request to GameInstance, which continues Demo Scene Graph past the hub node. The Switch reads 1, follows its 1 output, and loads Conversation Demo Scene.

Now select Agent Room Gate. It works the same way, except that its first listener writes 2. The order of the two listeners matters: the variable has to be set before EndSession runs, so that the graph reads the new choice. Keep that order when you build gates of your own.

To learn more, see Interaction System for interaction areas and options, and Scene Graph Node Types for the Switch and Cast nodes.

Follow the Return Path​

Rooms send you back to the hub in a similar way, with one step fewer. Open Agent Demo Scene and select Exit Zone. Its Exit interaction only calls GameMode.EndSession. It doesn't need to choose a destination, because the Agent scene node's Out port already leads back to the hub. The task scenes, Stroop Test and Survey, make the same call when their task is finished.

Despite its name, EndSession only ends the current scene, not the whole application. The graph decides what loads next. You also don't need to reset the selection variable when you return to the hub, because the next gate you walk through overwrites it.