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 R2023a. 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:
Plugins
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.RoadRunnerMaterials
— A plugin that contains the features of objects and base materials used in roadrunner scenes.
RoadRunner Project
RoadRunnerProject
folder — A folder containing prebuilt
scenes which you can directly edit using the RoadRunner scene editing software. This folder contains these
subfolders:
Scenes
— A folder containing the scene files for all prebuilt scenes.Assets
— A folder containing assets used to build the prebuilt scenes.
RoadRunner Scenes
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.
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
.
localFolder = "C:\project"
sim3d.utils.copyExampleSim3dProject(localFolder);
(Optional) Copy RoadRunnerProject
and RRScene
Projects to Local Folder
To customize the scene in the RRScene
project folder, copy the
project onto your local machine. To edit the prebuilt scenes directly using
RoadRunner, copy the RoadRunnerProject
project onto your local
machine.
Specify the path to the support package folder that contains the projects. Also specify a local folder destination to copy the projects. This code uses the support package path and local folder path from previous section.
rrProjectSupportPackageFolder = fullfile( ... matlabshared.supportpkg.getSupportPackageRoot, ... "toolbox","shared","sim3dprojects","roadrunner", ... "RoadRunnerProject"); rrProjectLocalFolder = fullfile(localFolder,"roadrunner/RoadRunnerProject");
Copy the
RoadRunnerProject
project from the support package folder to the local destination folder.if ~exist(rrProjectLocalFolder,"dir") copyfile(rrProjectSupportPackageFolder,rrProjectLocalFolder); end
All the prebuilt scenes and the assets are now located in the specified local folder.
Repeat Step 1 and 2 to copy the
RRScene
project to the local destination folder.rrSceneSupportPackageFolder = fullfile( ... matlabshared.supportpkg.getSupportPackageRoot, ... "toolbox","shared","sim3dprojects","driving", ... "RoadRunnerScenes","RRScene"); rrSceneLocalFolder = fullfile(localFolder,"RRScene"); if ~exist(rrSceneLocalFolder,"dir") copyfile(rrSceneSupportPackageFolder,rrProjectLocalFolder); end
The
RRScene.uproject
file and all of its supporting files are now located in a folder namedRRScene
within the specified local folder.