Simulation 3D Message Get
Libraries:
Vehicle Dynamics Blockset /
Vehicle Scenarios /
Sim3D /
Sim3D Core
Aerospace Blockset /
Animation /
Simulation 3D
Description
Note
Simulating models with the Simulation 3D Message Get block requires Simulink® 3D Animation™. If you had an Aerospace Blockset™ license prior to R2024a, you might be eligible to continue using Simulation 3D Message Get to simulate models in the 3D environment. For more information, see Opt-In Offer for Aerospace Blockset Unreal Engine Visualization Users.
The Simulation 3D Message Get block retrieves data from 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 Get block.
Tip
Verify that the Simulation 3D Scene Configuration block executes before the Simulation 3D Message Get block. That way, the Unreal Engine 3D visualization environment prepares the data before the Simulation 3D Message Get block 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 —
0
Simulation 3D Message Get —
1
For more information about execution order, see Control and Display Execution Order.
Configure Scenes to Send Data
To use the block, you must configure scenes in the Unreal Engine environment to send data to the Simulink model:
Install the customize 3D scenes for aerospace simulations.
In the Unreal® Editor, follow these general workflows to send data to Simulink.
Unreal Engine User
Workflow Blueprint
Instantiate the
Sim3DSet
actor that corresponds to the data type you want to send to the Simulink model. This example shows the Unreal EditorSim3DSet
data types.Specify an actor tag name that matches the Simulation 3D Message Get block Signal name parameter.
Navigate to the Level Blueprint.
Find the blueprint method for the
Sim3DSet
actor class based on the data type and size specified by the Simulation 3D Message Get block Data type and Message size parameters.For example, in Unreal Editor, this diagram shows that
Write Array Boolean
is the method for theSim3DSetBoolean
actor class that sends Boolean data type of array size 30.Compile and save the scene.
Note
By default, the Double Lane Change scene has a
Sim3DSetBoolean
actor with tag nameNumOfConesHit
.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 writer and assign the pointer in the method
Sim3dSetup
.In the method
Sim3dStep
, invoke theWriteSimulation3DMessage
function to write the data to the Simulink model.Delete the signal writer in the method
Sim3dRelease
of the actor.
For more information about the Unreal Editor, see the Unreal Engine Documentation.