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.
Action | Example |
---|---|
Create world and actor object in Unreal Engine visualization environment. | |
Build an actor from a predefined list of primitive shapes using the
createShape function. | |
Build an actor from a supported 3D file format. | |
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. | |
Visualize the actor orientation in different coordinate systems and use CoordinateSystem property to access supported coordinate systems. | |
Import a custom scene built and designed in RoadRunner into the Unreal Engine visualization environment. |
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.
Action | Example |
---|---|
View the actor simulation with Physical Attributes including Gravity. | |
View the actor simulation with Physical Attributes including LinearVelocity and AngularVelocity. | |
View the actor simulation with Physical Attributes including Force and Torque. | |
View the actor simulation with Physical Attributes including Friction and Restitution. |
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.
Action | Example |
---|---|
Use the MATLAB programmatic interface or Simulink blocks to control actor movement in the Unreal Engine visualization environment. | |
Remove an actor from the Unreal Engine visualization environment during run time. | |
Report actor events and access the actor properties during run time from the Unreal Engine simulation environment using MATLAB. | |
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. | |
Import and control actor placement and movement in the Unreal Engine visualization environment using Simulink. |
See Also
sim3d.Actor
| sim3d.World
| createShape
| createMesh
| load
| remove
| Simulation 3D
Actor | Simulation 3D Scene
Configuration