Program Development

Download and play DigitalTwin scenes

Digital Twin scenes crafted with FactVerse Designer are valuable resources stored in the library.
SDK
Beginner

Through this example, you will know:

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

Steps

1

Preparation

Install the latest version of FactVerse SDK | DataMesh.

2

Creating Digital Twin scene

  1. Log in to the FactVerse platform and create a working directory "SceneSample".

  1. On the Digital Twins page, click the Newbutton, select Template, create a template named "TemplateSample", and then enter the template details page.

  1. Add new Attribute Name:1|1, IsOpen:1|2, Temperature:1|3 to the template "TemplateSample".

  1. On the Digital Twins page, click the New button, and use the "TemplateSample" template to create the digital twin "TwinObject1".

  1. On the Digital Twins page, click the New button, create the digital twin scene "TwinScene", and enter the digital twin scene details page.

  1. In the digital twin scene details page, reference the digital twin "TwinObject1".

* Additional settings can also be made using the FactVerse Designer to modify the display effects of templates and digital twin scenes.

  1. Open the template in FactVerse Designer and add display models to the template.

3

 Usage example

  1. Navigate to the "04 FactVerse - Play a digitaltwin scene" directory and open the FactVerseSample scene.
  2. Select the FactVerseSample object and check its information in the Inspector panel.
  • FactVerseSample:
    • json configuration file: Similar to the example “Access the resource library”, this example uses the same DCS.json configuration file; no further modifications are needed.
    • Root object: Serves as the root object for playback, referenced in FactVerseSample. The Root object does not need to have any scripts attached.
  • Used for scene playback control, referenced in FactVerseSample. This object needs to be attached with the digitaltwin scene playback script. In the example, it is attached with SimulationSceneController, used for standalone scene playback.
  • DataMeshModule:
    • AccountManager: Account module
    • LibraryManager: Resource module
    • DirectorManager: Director-related definitions
    • AssetManager: Resource loading module
    • DigitalTwinManager: DigitalTwin scene module
  • Table: It provides the display of the floor in the scene.
    • TablePlane object (Prefab): The actual floor object.
  • MixedRealityPlayspace: MixedRealityPlayspace: Carries camera control functionalities related to the scene. The main camera in the scene needs to be replaced by this object.
    • CameraController script: The primary script for camera control, which references the floor object in the Table.

Note: Due to the lighting information contained in the Designer scene, the example has disabled the default lighting in the Unity scene.

  1. Make sure you've successfully logged in as outlined in the previous example “Logging into FactVerse.”
  2. Start this example. After loading, the download panel will appear.

  1. In the input box, enter the scene's address in the FactVerse library For example, /test/Sample 10.
  2. Click download. If the path is correct, the scene will be downloaded and parsed, and the related resource download begins. Once everything is downloaded, the scene will start playing automatically.

Note: During scene playback, lights will be created based on the scene settings.

An operation interface will be displayed at the bottom of the screen. At the top is the tenant ID, followed by the digital twin ID and its attribute group. The attribute group consists of several key-value pairs (e.g., "1|3": "30°C"). When the DFS server sends attribute changes to the specified digital twin for this tenant, the digital twin's attributes will change accordingly.

4

Note: DFS (Data Fusion Service) is a key tool on the FactVerse platform used for accessing and processing data from external systems. It supports data storage, cleaning, and transformation, and also allows users to customize data sets. Through DFS, digital twins can obtain and present external data in real-time, enabling a more accurate simulation and reflection of the operational status and changes of real-world equipment. For more information about DFS, please refer to the information published on the official website. If you need to use DFS services, please contact support@datamesh.com for technical support.