Install Support Package for Customizing Scenes
To customize scenes in the Unreal® Editor and use them in Simulink®, you must install the UAV Toolbox Interface for Unreal Engine® 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 UAV Toolbox Interface for Unreal Engine 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 UAV Toolbox Interface for Unreal Engine Projects support package. Click Install.
Note
You must have write permission for the installation folder.
Set Up Scene Customization Using Support Package
The UAV Toolbox Interface for Unreal Engine Projects support package includes these components:
An Unreal Engine project file (
AutoVrtlEnv.uproject
) and its associated files. This project file includes editable versions of the prebuilt 3D scenes that you can select from the Scene source parameter of the Simulation 3D Scene Configuration block.Two plugins,
MathWorkSimulation
andMathworksUAVContent
. These plugins establish the connection between Simulink and the Unreal Editor and is required for co-simulation.
To set up scene customization, you must copy this project and plugin onto your local machine.
Copy Project to Local Folder
Copy the AutoVrtlEnv
project folder into a folder on your local
machine.
Specify the path to the support package folder that contains the project. If you previously downloaded the support package, specify only the latest download path, as shown here. Also specify a local folder destination in which to copy the project. This code specifies a local folder of
C:\Local
.supportPackageFolder = fullfile( ... matlabshared.supportpkg.getSupportPackageRoot, ... "toolbox","shared","sim3dprojects","spkg"); localFolder = "C:\Local";
Copy the
AutoVrtlEnv
project from the support package folder to the local destination folder.projectFolderName = "AutoVrtlEnv"; projectSupportPackageFolder = fullfile(supportPackageFolder,"project",projectFolderName); projectLocalFolder = fullfile(localFolder,projectFolderName); if ~exist(projectLocalFolder,"dir") copyfile(projectSupportPackageFolder,projectLocalFolder); end
The
AutoVrtlEnv.uproject
file and all of its supporting files are now located in a folder namedAutoVrtlEnv
within the specified local folder. For example:C:\Local\AutoVrtlEnv
.
Copy Plugin to Unreal Editor
Copy the MathWorksSimulation
and
MathworksUAVContent
plugin folders into the
Plugins
folder of your Unreal Engine installation.
Specify the local folder containing your Unreal Engine installation. This code shows the default installation location for the editor on a Windows® machine.
ueInstallFolder = "C:\Program Files\Epic Games\UE_4.26";
Copy the plugins from the support package into the
Plugins
folder.mwSimPluginName = "MathWorksSimulation.uplugin"; mwSimPluginFolder = fullfile(supportPackageFolder,"plugins","mw_simulation","MathWorksSimulation"); mwUAVPluginName = "MathworksUAVContent.uplugin"; mwUAVPluginFolder = fullfile(supportPackageFolder,"plugins","mw_uav","MathworksUAVContent"); uePluginFolder = fullfile(ueInstallFolder,"Engine","Plugins"); uePluginDestination = fullfile(uePluginFolder,"Marketplace","MathWorks"); cd(uePluginFolder) foundPlugins = [dir("**/" + mwSimPluginName) dir("**/" + mwUAVPluginName)]; if ~isempty(foundPlugins) numPlugins = size(foundPlugins,1); msg2 = cell(1,numPlugins); pluginCell = struct2cell(foundPlugins); msg1 = "Plugin(s) already exist here:" + newline + newline; for n = 1:numPlugins msg2{n} = " " + pluginCell{2,n} + newline; end msg3 = newline + "Please remove plugin folder(s) and try again."; msg = msg1 + msg2 + msg3; warning(msg); else copyfile(mwSimPluginFolder, fullfile(uePluginDestination,"MathWorksSimulation")); disp("Successfully copied MathWorksSimulation plugin to UE4 engine plugins!") copyfile(mwUAVPluginFolder, fullfile(uePluginDestination,"MathworksUAVContent")); disp("Successfully copied MathworksUAVContent plugin to UE4 engine plugins!") 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 UAV Toolbox Interface for Unreal Engine 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 Unreal Engine Scenes Using Simulink and Unreal Editor.