Transition Aero.VirtualRealityAnimation to Unreal Engine 3D Environment
Classic Virtual Reality World is being replaced with a new 3D environment using 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.
To update your code and interface with the new 3D environment, you must use the sim3d.World class. While there are no direct replacements for the Aero.VirtualRealityAnimation functions, you can achieve similar tasks with the sim3d classes.
The table outlines the old functions and their equivalent new functions to achieve the same task.
Old Functionality | New Functionality | Description of New Functionality | More Information |
---|---|---|---|
Aero.VirtualRealityAnimation | sim3d.World (Simulink 3D Animation) | Create a 3D environment and co-simulate with the Unreal Engine simulation environment. |
|
addNode | sim3d.Actor (Simulink 3D Animation) | Create or import actor objects into the 3D environment. |
|
add (Simulink 3D Animation) | Add actor to 3D environment | ||
load (Simulink 3D Animation) | Load 3D models or actors into 3D environment | ||
addRoute | Parent | Use the Parent property to set any actor in the 3D environment as
the parent actor of a |
|
delete | delete | Create actor object in the 3D environment. Build actor from an imported 3D file. | |
initialize | Not required | Delete the sim3d.World or sim3d.Actor object. | |
addViewpoint | createViewport (Simulink 3D Animation) | Set the relative rotation of the actor object. | Use |
createViewpoint (Simulink 3D Animation) | Create custom view of 3D environment. | Obtain additional view windows with sensors such as Ideal Camera. | |
setView (Simulink 3D Animation) | Set view of 3D environment. | Interact with 3D Simulation Environment. | |
nodeInfo | world.Actors (Simulink 3D Animation) | List all of the | World.Actors is a structure containing the properties for each actor. |
play | view (Simulink 3D Animation) | Open the Simulation 3D Viewer window and display the 3D environment. |
|
run (Simulink 3D Animation) | Start the co-simulation with the Unreal Engine and update the Simulation 3D Viewer window at each time step. | ||
pause (Simulink 3D Animation) | Pause co-simulation with 3D simulation engine. | ||
resume (Simulink 3D Animation) | Resume co-simulation with 3D simulation engine. | ||
close (Simulink 3D Animation) | Resume co-simulation with 3D simulation engine. | ||
wait (Simulink 3D Animation) | Wait for co-simulation to complete. | ||
play (Simulink 3D Animation) | Play and interact with the recorded 3D animation data. | ||
removeNode | remove (Simulink 3D Animation) | Remove actor added to world or remove all actors in world. | |
removeViewpoint | deleteViewport (Simulink 3D Animation) | Delete viewport from 3D environment. | |
deleteViewpoint (Simulink 3D Animation) | Delete viewpoint from 3D environment. | ||
saveas | save (Simulink 3D Animation) | Save world object to MAT file. | |
updateNodes | Not required | Not applicable |
Use these sim3d functions to achieve your 3D tasks.
Task | Aero.VirtualRealityAnimation Functionality | Use This Instead | 3D Environment Description |
---|---|---|---|
Create world |
h = Aero.VirtualRealityAnimation; |
world = sim3d.World(Output=@OutputImpl); | Create 3D environment using The world object creates a default view point to view the 3D environment. |
Load world |
h.VRWorldFilename = “asttkoff.wrl”; |
load(world,'asttkoff.wrl'); | Load the VRML file in the world object. |
View World |
h.initialize(); |
| Initialization is not necessary. Use world.View to open and display the 3D environment in the Simulation 3D Viewer window. |
Access actors |
[~, idxPlane] = find(strcmp('Plane', h.nodeInfo)); |
| The actors in the scene are stored in a structure and can be
accessed using the Actors (Simulink 3D Animation) property in |
Edit actor properties |
load takeoffdata; h.Nodes{idxPlane}.TimeseriesSource = takeoffData; h.Nodes{idxPlane}.TimeseriesSourceType = 'StructureWithTime'; |
plane.Translation = [0 0 0]; | The default coordinate system of the 3D environment is the world coordinate system. For more information on the coordinate systems, see Coordinate Systems in Simulink 3D Animation (Simulink 3D Animation). For more information on the |
Animate actor and view 3D simulation |
h.play(); h.wait(); |
| These executions are done by the Opens and displays the 3D environment in the Simulation 3D Viewer window. Starts the co-simulation with the Unreal Engine. The OutputImpl function sends MATLAB® the data about the actor from the Unreal Engine environment. The run function updates the 3D environment data at each time step of the simulation using the data from the output function. See Visualize Aircraft Takeoff via Unreal Engine 3D Environment for an example of how to transform actors using timeseries data. |
See Also
Topics
- Transition Virtual Reality World to Unreal Engine 3D Environment (Simulink 3D Animation)
- MATLAB Transition Workflow (Simulink 3D Animation)
- Troubleshoot Transition Workflows (Simulink 3D Animation)