Main Content

3D Environment

Create, view, and interact with a 3D environment; configure prebuilt scenes and scenarios; co-simulate with Unreal Engine®

The 3D environment is a digital space designed to simulate real-world phenomena to explore and manipulate objects within the environment. You can use the MATLAB® or Simulink® interface to create, view, and interact with the 3D environment.

  • Visualize the 3D environment using the Unreal Engine from Epic Games® for photorealistic rendering. You can access advanced features, such as lighting and atmospheric conditions.

  • Programmatically create and view a 3D environment using MATLAB or a Simulink model.

  • Use MATLAB and Simulink to communicate with the 3D environment during run-time through the co-simulation framework with the Unreal Engine.

  • Import custom scenes and scenarios designed and built in RoadRunner and visualize using the Unreal Engine environment.

  • View the 3D environment in the Simulation 3D Viewer using the prebuilt scenes and you can navigate in the 3D environment using keyboard shortcuts and mouse control.

  • Record the 3D animation data as MAT file and play back the animation data to help troubleshoot issues. You can also record the animation as a video file to present the simulation results.

  • Enhance 3D environment interaction using hardware interface input devices such as a joystick and a space mouse. You can navigate, explore, and control actors within the environment during run time.

  • Customize prebuilt scenes and actors or create new scenes in the Unreal Engine simulation environment using the Simulink 3D Animation™ Interface for Unreal Engine Projects support package.

Classes

expand all

sim3d.WorldCreate 3D environment in Unreal Engine (Since R2022b)
sim3d.environment.WeatherConfigurationControl scene weather and sun position (Since R2024b)
sim3d.environment.GeospatialConfigurationCreate 3D environment in Unreal Engine (Since R2024b)
sim3d.io.VideoWriterCapture 3D simulation as video file (Since R2025a)
sim3d.io.JoystickCreate joystick device interface (Since R2025a)
sim3d.io.SpaceMouseCreate space mouse device interface (Since R2025a)

Functions

expand all

Manage World

addAdd actor to 3D environment (Since R2022b)
loadLoad 3D models or actors into 3D environment (Since R2024a)
saveSave world object to MAT file (Since R2024a)
removeRemove actor added to world or remove all actors in world (Since R2023a)

Manage Viewer

createViewportCreate view of 3D environment (Since R2022b)
createViewpointCreate custom view of 3D environment (Since R2025a)
setViewSet view of 3D environment (Since R2024b)
deleteViewportDelete viewport from 3D environment (Since R2024b)
deleteViewpointDelete viewpoint from 3D environment (Since R2025a)

Control Co-simulation

viewView 3D environment in Simulation 3D Viewer window (Since R2024b)
runRun co-simulation with the 3D simulation engine (Since R2022b)
pausePause co-simulation with 3D simulation engine (Since R2024a)
resumeResume co-simulation with 3D simulation engine (Since R2024a)
closeEnd co-simulation and close simulation window (Since R2024b)
waitWait for co-simulation to complete (Since R2025a)
playPlay recorded animation data (Since R2025a)
axisRead status of joystick (Since R2025a)
buttonRead status of joystick (Since R2025a)
capsJoystick capabilities (Since R2025a)
forceApply force feedback to joystick axis (Since R2025a)
povRead status of joystick point of view (Since R2025a)
readRead status of joystick button, axes, and POV (Since R2025a)
buttonRead status of space mouse (Since R2025a)
positionRead position of space mouse (Since R2025a)
speedRead speed of space mouse axis number (Since R2025a)
viewpointRead space mouse coordinates in viewpoint format (Since R2025a)
copyExampleSim3dProjectCopy support package files and plugins to specified folders (Since R2025a)
sim3d.EditorInterface to the Unreal Engine project (Since R2025a)
openOpen the Unreal Editor (Since R2025a)
ASim3dActorAbstract class to use as a base class for user-defined Unreal Engine C++ or blueprint actors (Since R2025a)
Sim3dSetupC++ method that sets up actor in Unreal Engine 3D simulation (Since R2025a)
Sim3dStepC++ method that steps actor in Unreal Engine 3D simulation (Since R2025a)
Sim3dReleaseC++ method that releases actor in Unreal Engine 3D simulation (Since R2025a)
StartSimulation3DMessageReaderConstructs a message reader object in the Unreal Editor (Since R2025a)
ReadSimulation3DMessageReceives message from Simulink model using a message reader object (Since R2025a)
StopSimulation3DMessageReaderDeletes message reader object in the Unreal Editor (Since R2025a)
StartSimulation3DMessageWriterConstructs a message writer object in the Unreal Editor (Since R2025a)
WriteSimulation3DMessageSends message to Simulink model using a message writer object (Since R2025a)
StopSimulation3DMessageWriterDeletes message writer object in the Unreal Editor (Since R2025a)

Blocks

expand all

Simulation 3D Scene ConfigurationScene configuration for 3D simulation environment (Since R2022b)
Simulation 3D Message GetRetrieve data from Unreal Engine visualization environment (Since R2025a)
Simulation 3D Message SetSend data to Unreal Engine visualization environment (Since R2025a)
Simulation 3D Video WriterCapture 3D simulation as video file (Since R2025a)
Simulation 3D JoystickProcess input from asynchronous joystick device
Simulation 3D Space MouseProcess input from space mouse device

Scenes

Empty SceneEmpty world
Blank SceneBlank scene
Empty GrassEmpty grass 3D environment
Curved RoadCurved road 3D environment
Straight RoadStraight road 3D environment

Topics

Simulation Basics

Scene Customization

Visualize Scenario

Featured Examples