How Unreal Engine Simulation for UAVs Works
R2026bUAV Toolbox provides a co-simulation framework that you can use to model UAV algorithms in Simulink® and visualize their performance in a virtual simulation environment. This environment uses the Unreal Engine® by Epic Games®.
Note
Simulating models in the 3D visualization environment requires Simulink 3D Animation™.
Understanding how this simulation environment works can help you troubleshoot issues such as sensors not detecting vehicles, blocks executing out of order, or unexpectedly slow simulations.
Communication with 3D Simulation Engine
When you run your algorithms using UAV Toolbox, Simulink co-simulates the algorithms with the 3D simulation engine through a lock-step mechanism. The lock-step mechanism is a synchronization approach where the simulation progresses in fixed time steps, and Simulink and the 3D simulation engine run sequentially. One simulation engine waits while the other simulation engine proceeds, so each simulation produces consistent results.
During each simulation step:
Simulink configures the initial settings of the 3D environment, including actor transformations and properties and the custom scene viewpoint. Simulink also uses 3D simulation engine feedback to determine the configuration parameters of the 3D environment and the actors.
The co-simulation framework sends data from Simulink to the 3D simulation engine.
The co-simulation framework sends a command signal to the 3D simulation engine indicating the end of data transfer.
The 3D simulation engine executes the simulation. The 3D simulation engine configures the 3D environment and the actors based on the data from Simulink, then provides updated information about the 3D environment and the actors.
The co-simulation framework sends data from the 3D simulation engine to Simulink.
The co-simulation framework sends an acknowledge signal to Simulink, indicating the end of data transfer from the 3D simulation engine.
To communicate with the 3D simulation engine, Simulink uses the Simulation 3D Scene Configuration block.
Block Execution Order
During simulation, the Unreal Engine simulation blocks follow a specific execution order:
The Simulation 3D UAV Vehicle blocks initialize the vehicles and send their Translation and Rotation signal data to the Simulation 3D Scene Configuration block.
The Simulation 3D Scene Configuration block receives the vehicle data and sends it to the sensor blocks.
The sensor blocks receive the vehicle data and use it to accurately locate and visualize the vehicles.
The Priority property of the blocks controls this execution
order. To access this property for any block, right-click the block, select
Properties, and click the General tab. By
default, Simulation 3D UAV Vehicle blocks have a priority of
-1, Simulation 3D Scene Configuration blocks
have a priority of 0, and sensor blocks have a priority of
1.
The diagram shows this execution order.

If your sensors are not detecting vehicles in the scene, the Unreal Engine simulation blocks might be executing out of order. Try updating the execution order and simulating again. For more details on execution order, see Control and Display Execution Order (Simulink).
Also be sure that all 3D simulation blocks are located in the same subsystem. Even if the blocks have the correct Priority settings, if they are located in different subsystems, they still might execute out of order.
Simulation Speed
Simulation speed depends on the stop time and the sample time of the simulation. The stop time is the duration of the simulation. The sample time is the time interval at which the simulation updates its output. The number of simulation steps is the ratio of stop time to sample time. A smaller step enables more detailed and accurate simulation but can increase computational load and simulation time.
To set the sample time in Simulink, use the Sample time parameter in the Simulation 3D Scene Configuration block. If you decrease the sample time, the software takes more samples per second, so simulation speed decreases.
If you want to slow down a 3D simulation to investigate system behavior, you can use simulation pacing. The pacing rate determines how fast the simulation runs relative to real time. A pacing rate of 1 means the simulation runs in real time. A rate greater than 1 increases speed beyond real time, and a rate less than 1 slows it down. You can configure simulation pacing in Simulink using the Simulation Pacing Options (Simulink).
Simulation speed also depends on model complexity, computational speed, and the speed at which the system can render a scene. Rendering speed depends on the system configuration. You can use the Simulink Profiler (Simulink) to analyze the distribution of simulation execution time among the simulation components and see the computational time of each component in the simulation.
See Also
Topics
- Simulate Simple Flight Scenario and Sensor in Unreal Engine Environment
- Simulate Safe Landing of UAV in Unexplored Environment Using Unreal Engine
- Unreal Engine Simulation for Unmanned Aerial Vehicles
- Unreal Engine Simulation Environment Requirements and Limitations
- Sensors for Unreal Engine Simulation
- Coordinate Systems for Unreal Engine Simulation in UAV Toolbox