Main Content


(To be removed) Add virtual reality visualization framework to block diagrams

vrphysmod will be removed in a future release. For more information, see Version History.



vrphysmod(virtualWorldFile,system) updates the Simulink® system (model or subsystem) that the Simscape™ Multibody™ smimport (Simscape Multibody) function generates.

The model must be on the MATLAB® path or already open prior to calling the vrphysmod function.

You can then save, rename, modify, and run the model. When you save the resulting model, be sure to preserve the relative path between the Simulink system and the virtual world 3D file.


collapse all

To update the model my model using the file my world.wrl:

vrphysmod('my world.wrl', 'my model');

To update the current system using the file my model.wrl:

vrphysmod('my model.wrl', gcs);

Input Arguments

collapse all

Virtual world file, specified as either .wrl, .x3d or .x3dv files.

The .wrl extension is optional for a VRML virtual world file. If the specified system was created with Simscape Multibody First Generation smimport (Simscape Multibody) function, you can specify also an .x3d or .x3dv file for the virtualWorldFile.

As necessary, vrphysmod adds additional blocks to visualize the mechanical system in virtual reality. The association between mechanical system bodies and corresponding nodes found in the virtual world 3D file is based on the name correspondence.

If your model contains several VR Sink blocks that refer to the same virtualWorldFile, this function attempts to consolidate the animation signals of that virtual scene into one VR Sink block.

Model or subsystem to be updated, created by the smimport (Simscape Multibody) function.


The SolidWorks® VRML export filter does not preserve part instance names and the part order in the resulting virtual world 3D file. Therefore, the association between such parts and the corresponding bodies in the block diagram is not always an exact match. In such cases, the function identifies nodes with partial matches and issues warnings. To prevent these warnings, ensure that node DEF names in the virtual world 3D file are identical to their corresponding bodies in the Simulink model before running this function.

If you receive this warning and the set of virtual world 3D files does not originate in the SolidWorks product, ignore the message. Other supported CAD tools also generate part names with similar names, but preserve them across different export formats.

Version History

Introduced in R2009a

collapse all

R2023b: To be removed

The vrphysmod will be removed in a future release. Instead, use sim3d classes and Simulation 3D blocks to interface MATLAB and Simulink with the Unreal Engine® 3D simulation environment. To get started, see Create 3D Simulations in Unreal Engine Environment.

See Also

| | (Simscape Multibody)