View Virtual World Remotely
The Simulink® 3D Animation™ software allows you to simulate a process on a host computer while running the visualization of the process on a client computer. You view the virtual world on the client computer using a web browser. This client computer is connected to the host computer through a network using the TCP/IP protocol. Setting up this configuration requires that you know the name or IP address of the host computer you want to access from the client computer.
Viewing a virtual world on a client computer is useful for:
Presentation of the results over the web
Distribution of computing and graphical power
This example explains how to display a simulated virtual world on a client computer. In this case, the client computer is a PC platform with a Simulink 3D Animation Web Viewer. For a similar example using the Orbisnap viewer, see View Virtual Worlds Remotely with Orbisnap).
In the following example, a Simulink window opens with the model of a simple automobile. The automobile trajectory (vehicle position and angle) is viewed in virtual reality:
On the host computer, in the MATLAB® Command Window, type
A Simulink window opens with the model of an automobile.
Double-click the VR Sink block. This block is in the right part of the model window.
A virtual world viewer also opens with a 3-D model of the virtual world associated with the model.
In the virtual world viewer, select the Simulation menu Block Parameters option.
A VR Sink block parameters dialog box opens.
Select the Allow viewing from the Internet check box.
This option allows any computer connected to the network to view your model. Do not select this box when you want your model to be private or confidential.
On the client computer, open your HTML5-enabled web browser. In the Address line, enter the address and Simulink 3D Animation port number for the host computer running the Simulink software. For example, if the IP address of the host computer is
To determine your IP address on a Windows® system, type
cmd, and enter
To determine your IP address on a UNIX® system, type the command
Click OK. An IP Configuration dialog box opens with a list of your IP, mask, and gateway addresses.
Alternatively, for Windows platforms, you can open a DOS shell and type
The web browser displays the main Simulink 3D Animation HTML page. Only one virtual world is in the list because you have only one Simulink model open.
Click VR Car in the Mountains.
The web browser displays a 3-D model of the virtual world associated with the model.
On the host computer, in the Simulink window, from the Simulation menu, click Run.
On the client computer, the animation of the scene reflects the process simulated in the Simulink diagram on the host computer.
You can tune communication between the host and the client computer by setting the Sample time and Transport buffer size parameters.
Use the web browser controls to move within this virtual world while the simulation is running.
On the host computer, in the Simulink window, from the Simulation menu, click Stop. On the client computer, close the web browser window.