PLCOutputTransform
PLCOutputTransform is a signal component that receives position and rotation data from external systems and applies it to Unity GameObjects. This signal type is essential for controlling object positions from external controllers, robots, or motion planning systems.
Overview
Section titled “Overview”PLCOutputTransform receives transform data from external interfaces and automatically applies position and rotation changes to the GameObject it’s attached to. The component handles both receiving data from external systems and applying it to the Unity transform in real-time.
Properties
Section titled “Properties”The current transform data as a Unity Pose structure.
- Type: Pose (Vector3 position + Quaternion rotation)
- Default: Transform position and rotation at initialization
- Use case: Contains both position (x, y, z coordinates) and rotation (quaternion) data for complete 6DOF control
Status
Section titled “Status”Internal status information for the signal.
- Type: StatusTransform
- Use case: Tracks connection status and value changes for interface management
Usage Examples
Section titled “Usage Examples”Basic Setup
Section titled “Basic Setup”- Add PLCOutputTransform component to a GameObject you want to control externally
- Connect the signal to your interface (S7, OPC-UA, MQTT, etc.)
- External systems can now send position and rotation commands
- The GameObject automatically moves to received positions
Robot Control
Section titled “Robot Control”// Example of controlling transform from a custom scriptpublic class RobotTargetController : MonoBehaviour{ public PLCOutputTransform robotTargetSignal;
void SetRobotTarget(Vector3 position, Quaternion rotation) { if (robotTargetSignal != null) { Pose targetPose = new Pose(position, rotation); robotTargetSignal.SetValue(targetPose); } }
void MoveToPosition(float x, float y, float z) { Vector3 targetPos = new Vector3(x, y, z); Quaternion currentRot = transform.rotation; SetRobotTarget(targetPos, currentRot); }}Interface Integration
Section titled “Interface Integration”PLCOutputTransform works with all realvirtual interfaces that support transform data:
- S7 TCP: Receives 28 bytes (7 floats: x,y,z position + x,y,z,w quaternion)
- OPC-UA: Subscribes to structured data with position and rotation components
- MQTT: Receives transform data as binary or JSON format
- Modbus: Reads from float register arrays
Data Format
Section titled “Data Format”The transform data is internally stored as:
- Position: Vector3 (x, y, z coordinates in millimeters)
- Rotation: Quaternion (x, y, z, w components for orientation)
- Byte Size: 28 bytes total (7 × 4-byte floats)
Methods
Section titled “Methods”Public Methods
Section titled “Public Methods”SetValue(Pose value)
Section titled “SetValue(Pose value)”Sets the transform value and triggers GameObject movement.
- Parameters: value - Unity Pose containing position and rotation
- Use case: Programmatically control object position and rotation
SetValue(byte[] value)
Section titled “SetValue(byte[] value)”Sets the transform value from byte array received from interface.
- Parameters: value - 28-byte array containing position and rotation data
- Use case: Internal method used by interfaces to update transform
SetTransformFromValue()
Section titled “SetTransformFromValue()”Applies the current signal value to the GameObject’s transform.
- Use case: Force immediate application of received transform data
SetValueToTransform()
Section titled “SetValueToTransform()”Updates the signal value from the GameObject’s current transform.
- Use case: Synchronize signal value with current GameObject position
Automatic Updates
Section titled “Automatic Updates”PLCOutputTransform automatically applies received transform data to the GameObject in FixedUpdate() when new values are received. This ensures smooth, real-time positioning without manual intervention.
Motion Smoothing
Section titled “Motion Smoothing”The component applies transform changes directly without interpolation. For smooth motion between positions, consider:
- Using intermediate waypoints from your external controller
- Implementing motion planning in your PLC or external system
- Adding animation components for interpolated movement
Coordinate Systems
Section titled “Coordinate Systems”PLCOutputTransform uses Unity’s local coordinate system:
- Position: Local position relative to parent GameObject
- Rotation: Local rotation relative to parent GameObject
- Units: Position values are typically in millimeters (realvirtual standard)
See Also
Section titled “See Also”- PLCInputTransform - For sending transform data to external systems
- Interfaces - Overview of all signal types and interface concepts
- S7 TCP - Siemens S7 interface supporting transform data
- OPC-UA - Industrial communication protocol with structured data support
© 2025 realvirtual GmbH https://realvirtual.io - 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.