Main Content

Troubleshoot Transition Workflows

When you transition your code or model from a VRML virtual world to the 3D environment in Unreal Engine®, you might encounter issues. You can use your VRML file to load the world in the 3D environment.

The table outlines the common issues you might encounter during the transition workflow in MATLAB® and Simulink®.

TaskDescriptionMATLAB WorkflowSimulink Workflow

Load VRML scenes.

If the 3D environment does not contain all the actors from the VRML file, create and add the missing actors to the 3D environment.

You can create actors using the classes or blocks listed in 3D Environment, Actors, and Sensors.

To customize scenes, install the Simulink 3D Animation™ Interface for Unreal Engine Projects support package. For more information on customizing scenes, see Customize Scenes in Unreal Engine for 3D Simulations.

Add actors using the sim3d.Actor class. Use the add function of the sim3d.World object to add the actor to the 3D environment.

Create actors using the Simulation 3D Actor block.

To create geometry shapes for the actor objects, use the sim3d.Actor object functions.

For 3D graphic primitives, use the createShape. For indexed faces, use the createMesh function.

Use the Initialization script in the Simulation 3D Actor block. For 3D graphic primitives, use the createShape. For indexed faces, use the createMesh function.

For actors with textures, you can load the texture file and apply it to the actor.

Use the Texture property in the sim3d.Actor object.

Use the Initialization script in the Simulation 3D Actor block to set the Texture property of the actor object.

When loading a VRML scene into the 3D environment, it is recommended to set the scene as Blank Scene or Empty Scene.

To select a prebuilt scene, set the Scene argument in the sim3d.World object to Blank scene or Empty scene.

To select a prebuilt scene, set the Scene name parameter in the Simulation 3D Scene Configuration block.

Access and control actor objects in the 3D environment.

Load functionality of the 3D environment does not support additional scene information and special vrnode objects, including sensors.

vrnode represents all the objects in the virtual world while in the 3D environment you can create the corresponding actors using the classes or blocks listed in 3D Environment, Actors, and Sensors.

The load functions of the sim3d.World and sim3d.Actor objects do not support all the vrnode objects.

Create the actors using the corresponding actor objects and add the actors to the 3D environment.

The Path to source file parameter does not support all the vrnode objects.

You can also add actors such as light and annotation using the Initialization script parameter in the Simulation 3D Actor block.

The actors loaded into the 3D environment from the VRML file are stored in a structure where you can access them. You can also view the actor hierarchy in the Simulation 3D Viewer window. For more information on how to interact with the 3D environment, see Interact with 3D Simulation Environment.

To access the actors stored in the structure, use the Actors property in the sim3d.World object.

You can view the actors loaded into the 3D environment from the actor hierarchy in the Simulation 3D Viewer window. You can access and control the actors using the input and output ports of the block.

The vrnode object properties differ from the actor properties or parameters.

For more information on the actor object properties, see the corresponding actor reference page.

For more information on the actor block parameters, see the corresponding block reference page.

After you load a VRML scene into the 3D environment, the actor transformations now follow the Unreal Engine coordinate system. For more details on the coordinate system, see Coordinate Systems in Simulink 3D Animation.

The actor rotation in the vr world uses axis angle rotation, specified as a real 1-by-4 vector. The actor rotation in the 3D environment uses Euler angles, specified as a real 1-by-3 vector. The function vrrotvec2sim3d(v) converts the axis angle rotation, v, to a real 1-by-3 vector in the Unreal Engine coordinate system.

To convert the translation from VRML to Unreal Engine coordinate system, swap the Y and Z coordinates.

To convert the rotation from axis angle rotation to Euler angles in the Unreal Engine coordinate system, use the function vrrotvec2sim3d.

To convert the translation from VRML to Unreal Engine coordinate system, swap the Y and Z coordinates.

To convert from axis angle rotation to Euler angles the Unreal Engine coordinate system, add a MATLAB Function block and use the function vrrotvec2sim3d.

To include the sensor nodes from the VRML file, create and add sensors using the classes or blocks listed in Sensors.

Use the sensor object functions listed in Sensors to extract the output from the sensor object.

Access the sensor output through the output ports in the sensor blocks.

Create viewpoint.

When you load the virtual world using the VRML file, you can access the viewpoints and set any viewpoint to display the 3D environment.

The viewpoints are stored in a structure where you can access them using the Viewpoints property in sim3d.World object. Create custom viewpoints using the createViewpoint function of the sim3d.World object.

Use the setView function of the sim3d.World object to set the viewpoint.

Access the viewpoints from the Scene view parameter of the Simulation 3D Scene Configuration block.

To set a viewpoint, select the viewpoint from the Scene view parameter. You can also create custom viewpoints using the Scene view parameter.

View the simulation.

To interact with the 3D environment, see Interact with 3D Simulation Environment.

To navigate in the 3D environment using keyboard shortcuts and mouse controls, see Navigate in 3D Environment.

Interact with the simulation.

You can also install the Simulink 3D Animation Interface for Unreal Engine Projects support package and use the Unreal® Editor to simulate within scenes from your own custom project.

If you encounter additional issues in transitioning your workflow, contact MathWorks technical support at Contact Technical Support.

Limitations

The sim3d classes and Simulation 3D blocks do not support the vr.canvas properties.

See Also

| | |

Topics