Install Support Package for Customizing Scenes
To customize scenes in your installation of the Unreal® Editor and simulate within these scenes in Simulink®, you must first install the Automated Driving Toolbox Interface for Unreal Engine 4 Projects.
Note
These installation instructions apply to R2022b. If you are using a previous release, see the documentation for Other Releases.
Verify Software and Hardware Requirements
Before installing the support package, make sure that your environment meets the minimum software and hardware requirements described in Unreal Engine Simulation Environment Requirements and Limitations.
Install Support Package
To install the Automated Driving Toolbox™ Interface for Unreal Engine® 4 Projects support package, follow these steps:
On the MATLAB® Home tab, in the Environment section, select Add-Ons > Get Add-Ons.
In the Add-On Explorer window, search for the Automated Driving Toolbox Interface for Unreal Engine 4 Projects support package. Click Install.
Note
You must have write permission for the installation folder.
Set Up Scene Customization Using Support Package
The Automated Driving Toolbox Interface for Unreal Engine 4 Projects support package includes these components:
AutoVrtlEnv
folder — An Unreal Engine project folder containing theAutoVrtlEnv.uproject
file and corresponding supporting files. This project contains editable versions of the prebuilt scenes that you can select from the Scene name parameter of the Simulation 3D Scene Configuration block.MathWorkSimulation
— A plugin that establishes the connection between Simulink and the Unreal Editor. It is required for co-simulation.MathWorksAutomotiveContent
— A plugin that contains the elements of automotive objects that can be modified using Unreal Editor. It is required for co-simulation.RoadRunnerScenes
folder — A folder containing the Unreal Engine project and corresponding executable for a scene that was created by using the RoadRunner scene editing software. This folder contains these subfolders:RRScene
— An Unreal Engine project folder containing theRRScene.uproject
file and corresponding supporting files. This project contains an editable version of the scene used in the Highway Lane Following with RoadRunner Scene example.WindowsPackage
— A folder containing the executableRRScene.exe
and supporting files. Use this executable to co-simulate the Simulink models explained in the Highway Lane Following with RoadRunner Scene example.
RoadRunnerMaterials
— A plugin that contains the features of objects in roadrunner scenes.
To set up scene customization, you must copy the
AutoVrtlEnv
project and MathWorksSimulation
plugin folder onto your local machine. To customize the RoadRunner scene used in the Highway Lane Following with RoadRunner Scene example, you must
also copy the RRScene
project onto your local machine and download
the RoadRunnerMaterials
plugin and copy it into your local project.
After you install and set up the support package, you can begin customizing scenes. If you want to use a project developed using a prior release of the Automated Driving Toolbox Interface for Unreal Engine 4 Projects support package, you must migrate the project to make it compatible with the currently supported Unreal Editor version. See Migrate Projects Developed Using Prior Support Packages. Otherwise, see Customize Scenes Using Simulink and Unreal Editor.
Copy AutoVrtlEnv
Project to Local Folder, and, MathWorksSimulation
and
MathWorksAutomotiveContent
Plugins to Unreal Editor
To copy all the support package components to a folder on your local machine and
configure your environment so that you can customize scenes, use the copyExampleSim3dProject
function. For example, this code copies the
files to
C:\project
.
sim3d.utils.copyExampleSim3dProject("C:\project");
(Optional) Copy RRScene
Project to Local Folder
To customize the scene in the RRScene
project folder, copy the
project onto your local machine.
Specify the path to the support package folder that contains the project. Also specify a local folder destination to copy the project. This code uses the support package path and local folder path from previous sections.
rrProjectSupportPackageFolder = fullfile( ... matlabshared.supportpkg.getSupportPackageRoot, ... "toolbox","shared","sim3dprojects","driving", ... "RoadRunnerScenes","RRScene"); rrProjectLocalFolder = fullfile(localFolder,"RRScene");
Copy the
RRScene
project from the support package folder to the local destination folder.if ~exist(rrProjectLocalFolder,"dir") copyfile(rrProjectSupportPackageFolder,rrProjectLocalFolder); end
The RRScene.uproject
file and all of its supporting files are
now located in a folder named RRScene
within the specified local
folder. For example: C:\Local\RRScene
.
(Optional) Copy RoadRunnerMaterials
Plugin to Unreal Editor
When customizing the scene in the RRScene
project folder, you
must also copy the RoadRunnerMaterials
plugin to your plugin
project folder.
Download the ZIP file containing the latest RoadRunner plugins. See Downloading Plugins (RoadRunner). Extract the contents of the ZIP file to your local machine. The extracted folder name is of the form
RoadRunner Plugins x.x.x
, wherex.x.x
is the plugin version number.Specify the path to the
RoadRunnerMaterials
plugin. This plugin is located in theUnreal/Plugins
folder of the extracted folder. Update this code to match the location where you downloaded the plugin and the plugin version number.rrMaterialsPluginFolder = fullfile("C:","Local","RoadRunner Plugins 1.0.3", ... "Unreal","Plugins","RoadRunnerMaterials");
In your local
RRScene
project, create aPlugins
folder in which to copy the plugin. This code uses the path to the localRRScene
project specified in the previous section.rrProjectPluginFolder = fullfile(rrProjectLocalFolder,"Plugins","RoadRunnerMaterials");
Copy the
RoadRunnerMaterials
plugin to thePlugins
folder of your local project.copyStatus = copyfile(rrMaterialsPluginFolder,rrProjectPluginFolder); if copyStatus disp("Successfully copied RoadRunnerMaterials plugin to RRScene project plugins folder.") else disp("Unable to copy RoadRunnerMaterials plugin to RRScene project plugins folder.") end
After you install and set up the support package, you can begin customizing scenes. If you want to use a project developed using a prior release of the Automated Driving Toolbox Interface for Unreal Engine 4 Projects support package, you must migrate the project to make it compatible with the currently supported Unreal Editor version. See Migrate Projects Developed Using Prior Support Packages. Otherwise, see Customize Scenes Using Simulink and Unreal Editor.