Main Content

Create 3D Simulations in Unreal Engine Environment

Simulink® 3D Animation™ interfaces MATLAB® and Simulink with a 3D simulation engine to create, view, simulate, and interact with a 3D environment containing actors. The 3D environment models a real world and is visualized using the Unreal Engine® from Epic Games®. For more details on the simulation environment, see How 3D Simulation in Unreal Engine Environment Works. To learn how to create a 3D environment with actors, simulate with the Unreal Engine simulation environment, and view the 3D simulation in Simulation 3D Viewer window using either MATLAB or Simulink, view the examples listed on this page.

You can programmatically create and view a 3D simulation using the sim3d classes in MATLAB or create a Simulink model using blocks from the Simulation 3D library.

Create World and Build Actor

To create and view a 3D environment with actors in MATLAB, you can use sim3d.World and sim3d.Actor objects and functions. In Simulink, use Simulation 3D Scene Configuration and Simulation 3D Actor blocks.

You can view the 3D simulation in the Simulation 3D Viewer window. Control the viewport programmatically using the createViewport function, or set the viewport with Scene view in the Simulation 3D Scene Configuration block. The Simulation 3D viewer window displays the 3D environment using the prebuilt scene. During run time, you can interact with the 3D simulation and edit the actor properties through the user interface in the Simulation 3D Viewer window. You can also navigate in the 3D environment using keyboard shortcuts and mouse controls. For more information, see Interact with 3D Simulation Environment.

ActionExample
Create world and actor object in Unreal Engine visualization environment.

Create World and Actor Using MATLAB

Create World and Actor Using Simulink

Build an actor from a predefined list of primitive shapes using the createShape function.

Build Actor from 3D Graphic Primitives Using MATLAB

Build Actor from 3D Graphic Primitives Using Simulink

Build an actor from a supported 3D file format.

Build Actor from Imported 3D File Using MATLAB

Build Actor from Imported 3D File Using Simulink

Build an actor from reference points in the X, Y, and Z axes to construct the build of a 3D model, called a mesh, using the createMesh function.

Build Actor from Mesh Data and Apply Texture Using MATLAB

Build Actor from Mesh Data and Apply Texture Using Simulink

Visualize the actor orientation in different coordinate systems and use CoordinateSystem property to access supported coordinate systems.

View Actor Orientation in MATLAB Coordinate System

Import a custom scene built and designed in RoadRunner into the Unreal Engine visualization environment.

Import RoadRunner Scene into Unreal Engine Using Simulink

Simulate Actors with Unreal Engine Simulation Environment

You can use MATLAB or Simulink to set the Properties of sim3d.Actor object and access the Unreal Engine simulation environment, including the physics engine, atmospheric effects, and object interaction events, such as collision.

Note

Enabling the Physics attribute will invoke use of the physics engine to control actor motion.

Communicate with Actors

You can communicate with the 3D simulation environment and interact with the actors during run-time through the co-simulation framework between Unreal Engine and MATLAB or Simulink. Create 3D simulations in MATLAB or Simulink and visualize the simulations using the Unreal Engine visualization environment. You can also set up sensors and sensor arrays to access information about the environment during simulation. For more information on sensors, see Sensors.

ActionExample
Use the MATLAB programmatic interface or Simulink blocks to control actor movement in the Unreal Engine visualization environment.

Simulate Actor Movement Using MATLAB

Simulate Actor Movement Using Simulink

Remove an actor from the Unreal Engine visualization environment during run time.

Delete Actor During Simulation Using MATLAB

Delete Actor During Simulation Using Simulink

Report actor events and access the actor properties during run time from the Unreal Engine simulation environment using MATLAB.

Report Events Using Actor Callbacks

Report events in the 3D environment and access the actor properties when an event occurs during run time from the Unreal Engine simulation environment using MATLAB.

Report Events Using Event Containers

Import and control actor placement and movement in the Unreal Engine visualization environment using Simulink.

Simulate a Quadcopter

See Also

| | | | | | |

Related Topics