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
  • Sensor using Colliders
  • Sensor using Raycasts
  • Common functions for Sensors using Colliders or Raycasts
  • Sensor Status
  • Sensor_Standard
Edit on GitHub
  1. Components & Scripts
  2. Sensors

Sensor

PreviousSensorsNextMeasure

Last updated 18 days ago

Sensors are detecting . The sensor can use BoxColliders or Raycasts for collision detection. A behavior component (e.g. Sensor_Standard) must be added to the Sensor for a connection to a PLC’s Input and Outputs.

This tutorial explains first steps with Sensors:

This picture shows a configured Sensor using Colliders in the demo model:

Sensor using Colliders

Because collisions are used to detect the Sensor status you need to take care that the sensor game object is on the appropriate collision layer which should be normally g4aSensor.

Because of limitations in the collision detection of Mesh Colliders you should always use Box Colliders with Sensors.

The Sensor can change the color by changing the material of the sensor. For this, you need to select Display Status.

Sensor using Raycasts

Another way for implementing Sensors is to use Raycasts. The advantage of a Raycasts is, that you don’t need to define colliders and you are totally free which Layers you would like to check with the Raycast.

Because there is no sensor geometry connected to a Raycast Sensor you need to define the Raycast Direction from the pivot point of the Gameobject and the Raycast length, as usual in mmm in realvirtual.io. In the game view the Raycast is shown as a Line Renderer which is automatically created on simulation start.

If the sensor is using Raycasts, the Raycast is always checked against colliders on the same Layer then the Sensor Gameobject itself. Optionally you can define additional Raycast Layers.

Raycast always needs to start before the collission with the detected component. Please make sure that the start of the sensor raycast is never inside of an object with needs to be detected.

Common functions for Sensors using Colliders or Raycasts

The current sensor status can be inspected under the section Sensor IO’s.

You can subscribe to the Unity Events on the Sensor.

Event MU Sensor is called on every MU detected by the Sensor.

Event Non MU Gameobjet Sensor is called for all colliders without an MU script that are colliding with the Sensor.

Sensor Status

Besides the color of the sensor you can check the state of the sensor in the section Sensor Status in the Inspector of the Sensor.

Sensor_Standard

The Sensor_Standard component provides the standard Sensor behavior and connectivity to the PLC inputs and outputs. With the property NormallyClosed=true it can be selected, as the sensor is true and the sensor is not occupied.

The Sensor_Standard is a blueprint for additional sensors that return various values such as distance, speed etc. to the PLC. We suggest you use this template as the starting point for building your own sensors.

It is possible to limit the sensor function to a certain Tag of the . You must enter the Tag in the property Limit Sensor To Tag.

Please check the for more information about the properties and methods of this component.

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

MU
Realvirtual.io Class Reference
https://realvirtual.io
MUs
Tutorial about adding Sensors to your Digital Twin