Main Content

Transition Virtual Reality World to Unreal Engine 3D Environment

Classic Virtual Reality World that uses VRML (or X3D) is being replaced with an enhanced 3D environment that uses Unreal Engine® from Epic Games®. The functions and blocks that allow you to build virtual reality worlds, import models, and link virtual reality worlds using VRML format to MATLAB® and Simulink® will be removed in a future release. Instead, use the sim3d classes and Simulation 3D blocks to create, interact with, and link 3D environments with MATLAB and Simulink. This topic describes how to transition your code or model from the VRML format virtual reality world to the 3D environment using Unreal Engine.

Update VR Blocks to Simulation 3D Blocks

To update your model and interface with the new 3D environment, you can use the Upgrade Advisor and Model Advisor checks to identify the blocks in your model that need to be replaced. To create a 3D environment and co-simulate with the Unreal Engine, you must include a Simulation 3D Scene Configuration block in your model. While the VR blocks have no direct replacements, you can complete similar tasks with the Simulation 3D blocks.

The table outlines the old blocks and their equivalent blocks that you can use to complete basic tasks. These Simulation 3D blocks are not direct one-to-one replacements for the VR blocks but offer improved capabilities for your 3D simulation projects. For more details on updating your model, see Simulink Transition Workflow.

Old BlockNew BlockDescription of New BlockMore Information
VR Sink

Simulation 3D Scene Configuration

Create a 3D environment and co-simulate with the Unreal Engine simulation environment.
Simulation 3D ActorCreate an actor object in 3D environment. Load the actor from the VRML file and control the actor in the 3D environment by enabling input ports.
VR Source

Simulation 3D Scene Configuration

Create a 3D environment and co-simulate with the Unreal Engine simulation environment.

Simulation 3D Actor

Create an actor object in 3D environment. Access the actor data from the 3D environment by enabling output ports.
VR To Video

Simulation 3D Scene Configuration

Create a 3D environment and co-simulate with the Unreal Engine simulation environment.

Simulation 3D Actor

Create an actor object in 3D environment. Access and control the actor in the 3D environment using input and output ports.

Simulation 3D Camera Get

Capture image data of the scene.
VR RigidBodyTree

Simulation 3D Scene Configuration

Create a 3D environment and co-simulate with the Unreal Engine simulation environment.

Simulation 3D Robot (Robotics System Toolbox)

Implement a robot in 3D environment.
VR Tracer

Simulation 3D Actor

Create an actor object in 3D environment. Add a sim3d.graphics.PathMarker object as a child actor to view the trajectory. Control the marker object by enabling the input and output ports of the block.

VR Text Output

Simulation 3D Actor

Create an actor object in 3D environment. Add a sim3d.graphics.Text object as a child actor to display information in the 3D environment. Control the object by enabling the input and output ports of the block.

Update vr Functions to Use sim3d Classes

To update your code and interface with the new 3D environment, use the sim3d.World class. While the vr functions have no direct replacements, you can complete similar tasks with the sim3d classes.

The table outlines the old functions and their equivalent new functions that you can use to complete basic tasks. These sim3d functions are not direct one-to-one replacements for the vr functions but offer improved capabilities for your 3D simulation projects. For more details on transitioning your code, see MATLAB Transition Workflow.

Old FunctionalityNew FunctionalityDescription of New FunctionalityMore Information
vrworldsim3d.WorldCreate a 3D environment and co-simulate with the Unreal Engine simulation environment.
vrnodesim3d.ActorCreate or import actor objects into the 3D environment.
vrimport

load

Import actors or models into the 3D environment.

  • You can use the load function of the sim3d.World object to load actors in the 3D environment.

sim3d.Actor

load

Create an actor object in the 3D environment.

Build the actor from an imported 3D file.

vrinsertrobot

sim3d.Actor

load

Create the actor object in the 3D environment.

Build the actor from an imported 3D file.

vrupdaterobot

Translation

Set the relative translation of the actor object.

Rotation

Set the relative rotation of the actor object.

vrdrawnowNot requiredNot applicable.

vr.canvas

view

Open the Simulation 3D Viewer window and display the 3D environment.

run

Start the co-simulation with the Unreal Engine and update the Simulation 3D Viewer window at each time step.

vrfigure

view

Open the Simulation 3D Viewer window and display the 3D environment.

run

Start the co-simulation with the Unreal Engine and update the Simulation 3D Viewer window at each time step.

vrplayplayPlay and interact with the recorded 3D animation data.
vrview

view

Open the Simulation 3D Viewer window and display the 3D environment.

run

Start the co-simulation with the Unreal Engine and update the Simulation 3D Viewer window at each time step.

vredit

sim3d.World

Create a 3D environment.

sim3d.Actor

Create and control the actor object using its properties.

See Also

| | |

Topics