realvirtual.io
  • Building Digital Twins with Unity and realvirtual.io
  • Basics
    • Installation
    • Demo Model
      • Old Demo Model
    • Editor User Interface
      • Hierarchy Window
      • 3D Views
      • Quick Edit
      • Move Pivot Points (Pro)
      • Selection Window (Pro)
      • Material Window (Pro)
      • Measurement (Pro)
      • Kinematic Tool (Pro)
      • Model Checker
    • Runtime UI
      • Group Manager
      • Debug Console
      • Responsiveness
      • Runtime Persistence
    • Importing and exporting
    • Folder structure
    • Tutorial
    • Physics
    • CAD import (Pro)
      • CADLink (Pro)
      • CAD Checker (Pro)
      • CAD Updater (Pro)
    • Reusable Components (Prefabs)
    • Cadenas parts4cad
    • Publishing the Digital Twin
    • Revision management
  • News
  • Login & Download Updates (Pro)
  • Components & Scripts
    • Realvirtual
      • Environment Controller
    • MU, Source and Sink
      • Source
      • Sink
    • Motion and Kinematic
      • Drive
      • Kinematic
      • Group
      • Joint
      • CAM
      • TransportSurface
      • Guided Transport
      • Drive behavior
      • Chain
      • Chain element
      • Motion for developers
    • Sensors
      • Sensor
      • Measure
      • MeasureRaycast
    • Picking and Placing MUs
      • Grip
      • Gripper
      • Fixer
      • Pattern
    • Changing MUs
      • MaterialChanger
      • PartChanger
      • Cutter
    • Scene Interaction
      • 3D Buttons
      • Screen Overlay Buttons
      • Scene Selectables
      • Lamp
      • Interact3D
      • UI components
      • HMI components (Pro)
        • Start your own HMI
        • HMI Tab
        • HMI DropDown
        • HMI Puschbutton
        • HMI Switch
        • HMI Value
        • HMI Text
        • HMI Slider
        • HMI Message
        • HMI Marker
      • ModelZoo (Pro)
    • Interfaces
      • Interface Tools
        • Signal Manager
        • Signal Importer Exporter
        • Signal Catcher
        • OnValueChangedReconnect
      • Signal Importer / Exporter
      • ABB RobotStudio (Pro)
      • Denso Robotics (Pro)
      • EthernetIP (Pro)
      • Fanuc (Pro)
      • FMI
      • Igus Rebel
      • MQTT (Pro)
      • Modbus (Pro)
      • OPCUA (Pro)
      • PLCSIM Advanced (Pro)
      • RoboDK (Pro)
      • RFSuite (Pro)
      • SEW SimInterface (Pro)
      • Siemens Simit Interface (Pro)
      • Simit Shared Memory (Pro)
      • Simulink (Pro)
      • S7 TCP
      • TwinCAT (Pro)
      • TwinCAT HMI (Pro)
      • UDP (Pro)
      • Universal Robots (Pro)
      • Wandelbots Nova (Pro)
      • Websocket (Pro)
      • Windmod Y200 (Pro)
      • Custom Interfaces
    • Performance Tools
      • Combine Meshes (Pro)
      • Create Prefab (Pro)
      • Hierarchy Cleanup (Pro)
      • Mesh Optimizer (Pro)
      • Performance Optimizer (Pro)
    • Defining Logic
      • Unity Scripting
      • Behavior Graph
      • Logicsteps
      • Unity Visual Scripting
      • Recorder
    • Robot Inverse Kinematics (Pro)
    • Volume Tracking (Pro)
  • Multiplayer (Pro)
  • Extensions
    • ModelZoo
      • Beckhoff TwinCAT
      • Siemens S7
      • Denso Cobotta 1300
      • Wandelbots Nova Fanuc CRX
      • Universal Robots UR10
      • Fanuc Roboguide
    • realvirtual.io AIBuilder
      • realvirtual.io AI Builder Overview
      • Generate AI Training Data
      • AI Training
      • Testing AI in a Digital Twin
      • Deploying the AI
    • realvirtual.io Simulation
      • Conveyor Library
      • Path System
        • Path finding
        • Line
        • Curve
        • Workstation
        • Catcher
        • Pathmover
    • realvirtual.io Industrial Metaverse
      • Setup Guide
      • VR Modules
      • AR Modules
      • Multiuser
    • AGX Physics
    • VR Builder
    • CMC ViewR
  • Advanced Topics
    • Render Pipelines
    • Mixed Reality with Meta Quest3
    • Upgrade Guide
      • Upgrade to 2022
    • Open Digital Twin Interface
    • Usefull Addons
    • Improving Performance
    • Supported Platforms
    • Compiler Defines
    • For Developers
      • Important Classes and Interfaces
      • Assembly Definitions
      • Starting your development
      • Class documentation
      • realvirtual Init Sequence
      • realvirtualBehavior Lifetime Methods
      • Testing
    • Newtonsoft JSON
    • Troubleshooting
  • Release Notes
  • AI Digital Twin Assistant (GPT4)
  • License Conditions
Powered by GitBook
On this page
  • Create a new scene
  • Starting your first scene
  • Insert the conveyor
  • Unpacking the Prefab
  • Delete realvirtual.io components from conveyor
  • Define the transport surface
  • Insert a Drive
  • Defining the transport direction and turning the Drive on
  • Insert a source
  • Test the conveyor
  • Insert a Sensor
  • Summary and what's next
Edit on GitHub
  1. Basics

Tutorial

Create a first Digital Twin with a conveyor, a source and a sensor

PreviousFolder structureNextPhysics

Last updated 17 days ago

In this short tutorial we are creating a small Digital Twin model with a source, a conveyor and a light barrier.

The needed 3D components are already available. If you would like to use own 3D data, you would need to import the 3D data from your CAD system using (included in realvirtual.io) or another suitable solution like for example .

Create a new scene

You should always create your models outside the realvirtual folder. This is because if you import a new Version of realvirtual.io, you would not like to destroy what you did. If you keep your scripts outside the realvirtual.io folder this will enable you to update your model with new releases of realvirtual.io without problems.

First create a new folder. We will call this folder Tutorial. Select assets and right click Create > Folder. Select the folder, hit F2 and name it to Tutorial.

For creating a new scene, select realvirtual > Create new realvirtual scene

After the scene is created, please save it with File > SaveAs in your Tutorial folder with the name tutorialmodel:

You should now have an empty scene with a base plate and some lights:

You can hide the big lights and camera gizmos by setting the Gizmo size to 0 (see above picture).

You could also create a totally empty standard Unity scene and add the realvirutal component(before 2022 game4automation component) by realvirtual> Add Object > realvirtual in the Main menu.

Starting your first scene

You can now start your first scene by pressing on Play in the top of the Unity UI.

Game view will automatically open and you can see the RuntimeUI as well as an empty model with just the base plate:

Insert the conveyor

Next we insert a 3D component. For the tutorial we use a prepared one, which is already used by the demo model. Select the conveyor under Assets > realvirtual> 3DPfefabs > ConveyorSmall and drag it into the scene. Place it somewhere in the middle of the base plate.

You can move the conveyor with the gizmo, which is visible as long as the conveyor is selected. Or you put in 0,0,0 into the Transform Position property. This will place the zero point of the conveyor onto the world zero point (which should be also the middle of the base plate):

Unpacking the Prefab

For the Tutorial, we should Unpack the Prefab instance completely and cut all dependencies to the original Prefab. Please select ConveyorSmall in the scene and with the context menu select Prefab > Unpack Completely:

Delete realvirtual.io components from conveyor

This step is optional. The conveyor prefab is already equipped with some realvirtual.io components. But we would like to show you in this tutorial the full workflow. Like it would be without anything prepared - based on imported 3D objects.

This is why we are deleting the components and add them later on again. You could also skip this step if wished and continue with Insert a source.

Remove the component Drive on the object ConveyorSmall and also remove afterwards the Rigidboy on the object ConveyorSmall:

Next delete Transport Surface, Box Collider and Rigidboy on ConveyorSmall.Conveyor.Conveyor.

You learned how to remove scripts from objects ;-). You now removed everything what is prepared and we will add these needed scripts again in this tutorial.

Define the transport surface

We now have an empty 3D component. No kinematic and physical behavior is defined yet. This is what a component would look like after the CAD import. CAD systems do not contain any information other than the structure and geometry. This means that we have to define all mechatronic behaviors like drives and sensors in realvirtual.io.

First we need to add a Transport Surface to the conveyor. For doing that we select the component ConveyorSmall.Conveyor.Conveyor. We select in the main menu realvirtual> Add Script > Transport Surface or we drag and drop the script TransportSurface under Assets>game4automation onto ConveyorSmall.Conveyor.Conveyor.

The Quick Edit overly buttons can be opened by pushing F1 inside the scene view.

Insert a Drive

Select the ConveyorSmall.Conveyor.Conveyor component in your Scene and select in the main menu realvirtual> Add Script > Drive :

Alternatively you can also drag and drop the Drive Script under Assets > realvirtual> Drive onto the Inspector window of ConveyorSmall.Conveyor.Conveyor.

Or as before you can also use the QuickEdit Overlay Window.

Your model should now look like this:

Please remember. Most times you can add scripts on 3D components in 4 ways

  • With the main menu

  • By dragging and dropping it from the Assets folder Assets>game4automation

  • by using Add Component in the Inspector window

  • or by using the QuickEdit overlay

Defining the transport direction and turning the Drive on

Insert a source

A Source is automatically creating new components based on itself (what is called "spawning" in Unity).

Please select Assets > realvirtual> 3DPrefabs > Can and drag and drop it into the scene. Place the can at the beginning and on top of the conveyor.

Another way for creating the "standard" can source is to select the TransportSurface within the scene and to press INS on the keypoard.

Your model now looks like this:

Please move the source to the beginning of the conveyor.

Test the conveyor

Now we can test the conveyor. Start the simulation with the Unity Play button.

You might see that the texture on the conveyor is not moving in the right relation and the right direction. You need to set the texture scale yourself. Please select the TransportSurface and enter a -2 into property Texture Scale.

Insert a Sensor

Next select realvirtual > Add Componet > Add Sensor or select Sensor on the QuickEdit overlay.

Last but not least you need to move the Sensor GameObject to the end of the TransportSurface.

Your model now looks like this:

Now you can start again the simulation and you will see, that the Sensor is getting occupied (red):

Don't forget to save your model by selecting File > Save

Summary and what's next

The realvirtual component provides some basic lights, mouse navigation in the deployed Digital Twin (Game view) as well as all standard settings and the standard .

The conveyor belt that you have inserted into the scene is what is called a prefab. A prefab is a type of template and can be a very simple or a very complex component. A Prefab can be used multiple times in one or more scenes. As long as the embedded instances of the prefabs are not "unpacked" in the scene, they are still associated with the Prefab and inherit any changes to the prefab itself. For more information on the Unity Prefab System, see the Unity documentation here: .

Unfortunately, until now there is no standard format for exporting extended information from the CAD system. However, our allows you to develop your own exporter for the CAD system.t.

A very easy way is, to use the for adding the :

We now insert a on the Conveyor. We place it on the same component as the before.

And as a 3rd option you could also use Add Component on the Inspector window and than type in and select the filtered script to assign it to the 3D component.

Next we define some properties of the within the Inspector window. Please also check if the Direction is set to Linear X (so that the shown transport direction is forward).

Please check, that the is assigned to the , which usually is done automatically. Set JogForward to True and TargetSpeed to 300.

This settings will automatically start the when the simulation is starting.

As a last step we would like to place a (light beam) at the end of the conveyor.

Please create an empty GameObject into the Scene by selecting GameObject > Create Empty or by selecting on the QuickEdit overlay. If your new GameObject is added as a child please drag and drop it to the top level in your model. Rename the new GameObject to Sensor.

This is just a first quick starter. Please check the and learn how the functions are realized. Also check the section to learn more about the physics simulations, collision detection and kinematic movements. Based on that you should check the whole section to learn more about the details.

© 2025 realvirtual GmbH - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.

Runtime UI
https://docs.unity3d.com/Manual/Prefabs.html
Open Digital Twin Interface
Drive
TransportSurface
Drive
Drive
TransportSurface
Drive
Drive
Sensor
Demo model
Physics
Components & Scripts
https://realvirtual.io
CADLink
Unitys PIXYZ
TransportSurface
QuickEdit
Create a new Tutorial folder
Create a new scene
Saved new scene in the Tutorial folder
Empty scene
Playing the empty model
Placed conveyor into the empty scene
Unpacking a prefab
Remove the component Drive
Adding a TransportSurface to the conveyor with QuickEdit
Added Drive and TransportSurface to the conveyor
Changing the inspector properties of the Drive
Added source to the conveyor
Your first Digital Twin - a conveyor with the source
Added Sensor to the end of the TransportSurface
Sensor in the Digital Twin during simulation