Simulation 3D Message Set
Send data to Unreal Engine visualization environment
Libraries:
Vehicle Dynamics Blockset /
Vehicle Scenarios /
Sim3D /
Sim3D Core
Aerospace Blockset /
Animation /
Simulation 3D
Simulink 3D Animation /
Simulation 3D /
Utilities
Description
Note
Simulating models with the Simulation 3D Message Set block requires Simulink® 3D Animation™.
The Simulation 3D Message Set block sends data to the Unreal Engine® 3D visualization environment. In your model, ensure that the Simulation 3D Scene Configuration block is at the same level as the Simulation 3D Message Set block.
Tip
Verify that the Simulation 3D Message Set block executes before the Simulation 3D Scene Configuration block. That way, Simulation 3D Message Set prepares the signal data before the Unreal Engine 3D visualization environment receives it. To check the block execution order, right-click the blocks and select Properties. On the General tab, confirm these Priority settings:
Simulation 3D Scene Configuration —
0Simulation 3D Message Set —
-1
For more information about execution order, see Control and Display Execution Order.
Configure Scenes to Receive Data
To use the block, you must configure scenes in the Unreal Engine environment to receive data from the Simulink model:
Install the Customize 3D Scenes for Vehicle Dynamics Simulations.
In the Unreal® Editor, follow these general workflows to receive data from Simulink. For detailed information, see Get Started Communicating with the Unreal Engine Visualization Environment.
Unreal Engine User
Workflow Blueprint
Instantiate the
Sim3DGetactor that corresponds to the data type you want to receive from the Simulink model. This example shows the Unreal EditorSim3DGetdata types.
Specify an actor tag name that matches the Simulation 3D Message Set block Signal name parameter.
Navigate to the Level Blueprint.
Find the blueprint method for the
Sim3DGetactor class based on the data type and size that you want to receive from the Simulink model.For example, in Unreal Editor, this diagram shows that
Read Scalar Integeris the method forSim3DGetIntegeractor class to receiveint32data type of size scalar.
Compile and save the scene.
Note
By default, the Double Lane Change scene has a
Sim3DGetIntegeractor with tag nameTrafficLight1.C++ class
Create a new actor class for the mesh or asset that you want the Simulink model to interact with. Derive it from
ASim3dActor.In the new actor class:
Declare a pointer to the signal name as a class field.
Get the class tag.
Create a signal reader and assign the pointer in the method
Sim3dSetup.In the method
Sim3dStep, invoke theReadSimulation3DMessagefunction to read the data from a Simulink model.Delete the signal reader in the method
Sim3dReleaseof the actor.
For more information about the Unreal Editor, see the Unreal Engine Documentation.

