Program Development

Download and play Director scenarios

This example aims to demonstrate how to download and play Director scenarios in the FactVerse resource library
SDK
Advanced

Through this example, you will know:

  • Find and download a resource using its path
  • Read scenario resources
  • Download additional resources required for the scenario
  • Play the scenario
  • Control scenario playback

Steps

1

Preparation

Install the latest version of FactVerse SDK | DataMesh.

2

Navigate to the "03 Director - Play a scenario" directory and open the DirectorSample scene.

3

Select the DirectorSample object and review the details in the Inspector panel.

    1. Similar to the previous example, this one uses the same DCS configuration fileand no further modifications are needed.
    2. Set a Root object as the root object for playback, and reference it in DirectorSample. The Root object does not need any scripts attached.
    3. Set a BackStage object to store objects not currently displayed and reference it in DirectorSample. Attach the "BackStage" script to this object.
    4. Set a ScenarioController object for scenario playback control and reference it in DirectorSample. This object needs to have the Director play script attached to it. In the example, the SimpleScenarioController is attached, which is used for standalone scenario
4

Pay attention to the objects (Prefab) under the DataMeshModule:

    1. AccountManager:Account module
    2. LibraryManager:Resource module
    3. DirectorManager:Director-related definitions
    4. AssetManager:Resource loading module
5

Note the Table object in the scene, it provides the display of the floor in the scene.

    • The TablePlane object (Prefab) underneath it is the actual floor object.
6

Note the MixedRealityPlayspace object (Prefab) in the scene,which carries the camera control related functions in the scene. The main camera in the scene needs to be replaced by this object.

    • Pay attention to the CameraController script on MixedRealityPlayspace; it is the main script for camera control, and it references the floor object in the Table.
7

Note that the lights in the scene are turned off because the Director scenario contains lighting information.

8

Make sure you've successfully logged in as outlined in the previous example, "Logging into FactVerse."

9

Start this example. After loading, the content of the current library will be displayed.

In the input box, enter the scenario's pathin the FactVerse library (e.g., /test/Sample.dirpkg).

10

Click download.If the path is correct, the scenario will be downloaded. If the address is correct, the scenario will be downloaded and parsed, and the related resource download begins. Once everything is downloaded, the scenario will start playing automatically. Note: Lights will be created during scenario playback based on the scenario settings.

11

Operation UI will be displayed at the bottom of the screen, where you can click "Prev" for the previous step or "Next" for the next step to control the scenario playback. Note: If the scenario contains camera animations, the camera will be driven by the scenario during playback.