Drive
Last updated
Last updated
Drives control the movement of GameObjects along a defined axis. They are used for any moving component in the scene—except for freely moving (MovingUnits), which are handled differently.
A Drive itself does not provide signal interfaces for PLC communication. To enable PLC interaction, you must attach a component to the same GameObject that contains the Drive script. This separates the motion logic from the signal interface logic, keeping the system modular and flexible.
💡 Hint The Drive direction for a linear axis is always defined based on the local coordinate system of the GameObject the Drive is attached to. For a rotational axis, the origin of the local coordinate system acts as the center of rotation, and the object rotates around the defined axis. A Drive can also be connected to a Transport Surface—in this case, only MUs on the Transport Surface will be moved by the Drive.
💡 Hint The standard units for Drive positions in all realvirtual.io components are: • Millimeters for linear Drives • Degrees for rotational Drives
Corresponding speed units are: • Millimeters per second for linear movement • Degrees per second for rotation
In Unity, 1 millimeter equals 1 Unity unit, meaning that 1 meter = 1000 Unity units in realvirtual.io. While you can change this scaling in the , doing so is not recommended, as it may lead to inconsistencies in physics and interaction.
In the demo cell, Drives are responsible for moving the different parts of the CNC machine. The motion structure is defined by the parent-child hierarchy of GameObjects in Unity, which establishes the kinematic chain of the machine.
💡 Hint If the imported CAD data does not match the required kinematic hierarchy, you can use the Kinematic component to define a separate motion hierarchy that references the original CAD parts. This allows you to build a clean and functional motion structure without modifying the original CAD GameObject hierarchy.
The Drive component in the Unity Inspector includes several properties that control motion behavior and configuration. These properties are explained in detail below.
Handles are only displayed if the Drive Gizmo is turned on
If you select a Drive in the Unity editor special handles are displayed additionally to the standard handles for geometrically moving the drive position. With these handles you can define visually the direction of the drive.
The current direction is shown in pink. You can click again on the currently selected direction to invert the positive direction of the drive. If you click on one of the other two gray directions the drive direction will be changed.
For rotational axis the direction is displayed like that:
The pink arrow shows the positive direction. For rotational axis you can change also invert the direction by clicking on the pink arrow or you can change it by licking on the gray arrows.
It is possible to define upper and lower limits for drives. These limits are only used when driving the drive with the JogForward and JogBackward bit. The limits are displayed in edit and simulation mode:
For linear axis the upper limit is shown with the arrow. The arrow begins exactly at the Upper Limit position. The lower Limit is shown with a box. For rotational axis the limit is displayed by a trimmed circle. The drive is only able to rotate in the white area.
💡 Hint Avoid using position limits on Drives that are connected to a motion or robot controller. These controllers usually handle motion constraints internally. Enabling limits in this case might hide incorrect target positions, making it harder to detect configuration or control errors.
⚠️ Attention Jogging with acceleration and Drive limits is currently not supported. If you enable both features, the Drive behavior may not function as expected.
In simulation mode you can’t change the directions of the drives. With the handles you are able to start the drive in jog mode in each direction. If a drive limit is defined, the drive is stopping at it’s limit. Additionally the current position of the drive is displayed in mm. For rotational axis it is displayed in degrees.
Alternatively you can move the selected drive with Hotkeys. Key 1 is moving the drive to the negative direction. Key 3 is moving the drive to the positive direciton.
By default, linear and rotational Drives operate without using Unity's PhysX Rigidbody system. This approach is generally more stable and predictable, especially for automation and simulation scenarios.
In some cases, however—such as when interacting with physical objects or colliders—it may be necessary to move the Rigidbody component directly. To do this, you must enable the “Move This Rigid Body” option in the Drive component.
💡 Hint Only enable “Move This Rigid Body” if you explicitly need Drive motion to affect Unity physics. In most use cases, this setting should remain disabled to ensure optimal simulation stability and performance.
Direction: Selects the movement axis. Choose from linear (X
, Y
, Z
) or rotational (Rotation X
, Rotation Y
, Rotation Z
). Movement is always defined in local coordinate system.
Reverse Direction: Inverts the movement direction along the selected axis.
Offset: Applies an offset to the Drive’s position. This value is added to the internal position during simulation.
For example, if the Offset
is set to 100 and the Current Position
is 50, the resulting position in the simulation is 150.
This is useful when aligning Drive values with external systems, such as PLCs, where a consistent value shift is required for coordination.
Start Position: The Drive's starting position when the scene starts or the Drive is reset.
Speed Override: Multiplies the base speed to dynamically adjust how fast the Drive moves.
Speed Scale Transport Surface: Scales the speed if connected to a Transport Surface (default: 1).
Move This Rigid Body: Enables the Drive to move the attached Rigidbody (not recommended unless Unity physics interaction is required).
The Drive IOs section contains input and output fields that allow to interact with the Drive during simulation.
Jog Forward Boolean input to jog the Drive forward as long as the signal is active. Uses the set Target Speed without acceleration smoothing.
Jog Backward Boolean input to jog the Drive in the opposite direction. Also uses Target Speed and ignores acceleration settings.
Target Position A numeric input defining the desired position (in millimeters or degrees) that the Drive should move to. Can be controlled via script or PLC.
Target Speed Defines the maximum speed the Drive can reach when moving toward the Target Position. Value is in mm/s (for linear) or deg/s (for rotational).
Target Start Move Boolean input signal to start the move toward the Target Position using the defined Target Speed. Only starts the motion; does not affect target value.
Reset Drive Resets the Drive position to the configured Start Position. Can be triggered manually or via a PLC signal.
Stop Drive Immediately stops the Drive's motion, overriding current target or jogging input.
Is At Upper Limit Boolean output indicating whether the Drive has reached its defined Upper Limit (if limits are enabled).
The Limits section allows you to define positional constraints for the Drive. These are useful for preventing movements beyond mechanical boundaries or for guiding logic in manual or automated scenarios.
Use Limits Enables or disables the use of movement boundaries. When enabled, the Drive will be restricted to the range defined by the Lower Limit and Upper Limit.
Lower Limit / Upper Limit Define the minimum and maximum allowed positions for the Drive. Values are in millimeters (for linear Drives) or degrees (for rotational Drives).
Jump to Lower Limit on Upper Limit If enabled, once the Drive reaches the Upper Limit, it immediately jumps to the Lower Limit and continues motion. This is useful for circular or rotary indexing systems, e.g., turntables.
Limit Ray Cast Optional field for assigning a sensor GameObject (typically a virtual proximity sensor). This allows detection of the limit not only by position but also via raycast-based sensor feedback.
💡 Hint Avoid enabling Limits when the Drive is controlled by an external motion or robot controller. The controller may send positions outside the defined range, and the limits could silently clip or block the motion—making it harder to detect misconfiguration or errors.
The Acceleration section allows you to simulate smooth motion profiles by controlling how the Drive accelerates and decelerates.
Use Acceleration Enables acceleration-based motion. When disabled, the Drive moves at constant speed directly toward the target.
Smooth Acceleration (only Professional Version) Activates smoothing of acceleration and deceleration using a jerk-controlled motion profile. This results in more realistic movement, particularly for robotics and high-speed systems.
Acceleration Maximum allowed acceleration in mm/s² (linear) or deg/s² (rotational). This value defines how quickly the Drive can ramp up or down in speed.
Jerk (only Professional Version) Maximum rate of change in acceleration (mm/s³ or deg/s³). Helps to create soft starts and stops by avoiding abrupt changes in force or torque.
💡 Hint Avoid using acceleration together with Jogging, as they are not compatible.
The Smooth Motion section is available exclusively in the Professional edition of realvirtual.io. It provides detailed visualization and control of the motion profile calculated for the Drive based on the configured Acceleration and Jerk settings.
Profile
This subsection visualizes the generated motion curves for the current move:
Position – The Drive’s motion over time.
Velocity – The rate of change of position.
Acceleration – The rate of change of velocity.
Jerk – The rate of change of acceleration.
Duration – Total time (in seconds) required to complete the current motion based on the active profile.
These curves are generated in real time and give insights into how the Drive will behave during its movement.
State
Position / Velocity / Acceleration – The current state of the Drive in simulation time.
Target State
Position / Velocity / Acceleration – The values the Drive is targeting. These update based on user input or external control signals.
The Drive Status section provides real-time diagnostic information about the current motion and condition of the Drive. These values are continuously updated during simulation and are useful for debugging, monitoring, and interfacing with automation systems.
Fields
Current Speed Displays the Drive’s current speed in mm/s (linear) or deg/s (rotational).
Current Position The current absolute position of the Drive, including offset and any external overrides.
Position Overwrite Value Shows a temporary value applied when overriding the position manually or via external control logic.
Is Position Displays the final calculated position of the Drive after applying offset and override. This is the effective position used in simulation.
Is Stopped True if the Drive is currently not moving and not jogging.
Is Running True while the Drive is in motion, either toward a target position or while jogging.
Is At Target Speed Indicates whether the Drive has reached the defined Target Speed.
Is At Target True when the current position equals (within tolerance) the Target Position.
Is At Lower Limit True when the Drive has reached or exceeded the defined Lower Limit (if limits are enabled).
Is Sub Drive Marks whether this Drive is being controlled as a sub-drive in a more complex motion chain (e.g., a multi-axis system).
The Drive Events section provides Unity Events that are triggered at specific points during the Drive’s simulation cycle. These are intended for expert users who want to attach custom logic directly to the Drive’s behavior.
Available Events
On Before Drive Calculation (Drive) Called before the Drive calculates its movement each frame. This is useful for injecting custom control logic or modifying inputs before the Drive updates.
On After Drive Calculation (Drive) Called after the Drive completes its motion logic for the frame. Useful for monitoring state, triggering custom events, or applying additional logic.
💡 Hint Drive Events are intended for advanced users who need low-level access to the Drive’s behavior. For typical applications and PLC connections, it is recommended to use Behavior components such as
DriveBehavior
.
🔗 For more information about the Drive update cycle, please refer to Section: Motion for Developers in this documentation.
This picture is showing how two drives are connected to the Axis of the handling system in the :
Active: Defines whether the Drive is active. Usually this should be set to Always. For more infomation please check ConnectionStatus in
Transport Surfaces: Allows linking s to the Drive. Only s on linked surfaces are moved.
💡 Hint The Drive IOs can be accessed and controlled via custom scripts, making them flexible for user-defined behaviors. In most cases, they are used by which handle the connection between the Drive and external systems such as PLC signals. This setup separates physical motion from control logic, allowing clean integration with automation environments.
🔗 For more information about jerk in physics, see:
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.