| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink 3D Animation |
| Contents | Index |
| Learn more about Simulink 3D Animation |
| On this page… |
|---|
Displaying a Virtual World and Starting Simulation Viewing a Virtual World with a Web Browser on the Host Computer Viewing a Virtual World with a Web Browser on the Client Computer |
This section shows how to view a virtual world connected to a Simulink block diagram and make parameter changes from the Simulink block or the virtual world.
This example explains how to display a simulated virtual world using the Simulink 3D Animation viewer on your host computer. This is the default and recommended method for viewing virtual worlds. A Simulink window opens with the model of a simple automobile. Automobile trajectory (vehicle position and angle) is viewed in virtual reality:
In the MATLAB Command Window, type
vrtut1
A Simulink window opens with the model of an automobile.

A VRML viewer also opens with a 3-D model of the virtual world associated with the model.

In the Simulink 3D Animation viewer, from the Simulation menu, click Start.
The simulation starts. In the Simulink 3D Animation viewer, a car moves along the mountain road.
Use the Simulink 3D Animation viewer controls to move the camera within this virtual world while the simulation is running. For more information on the Simulink 3D Animation viewer controls, see Simulink 3D Animation Viewer.
In the Simulink 3D Animation viewer, from the Simulation menu, click Stop.
If you close the viewer window, you might want to reopen it. In the Simulink model window, double-click the VR Sink block.
Your default viewer opens and displays the virtual scene. For more information on setting your default viewer, see Setting the Default Viewer of Virtual Scenes.
Multiple instances of the viewer can exist on your screen. A viewer appears each time you select the File menu New Window option in the Simulink 3D Animation viewer. This feature is particularly useful if you want to view one scene from many different viewpoints at the same time.
Normally, you view a virtual world by double-clicking the VR Sink in the Simulink model. The virtual world opens in the Simulink 3D Animation viewer or your VRML-enabled Web browser, depending on your DefaultViewer setting. For more information on setting your default viewer, see Setting the Default Viewer of Virtual Scenes.
Alternatively, you can view a virtual world in your Web browser by selecting an open virtual world from a list in your Web browser. You can display the HTML page that contains this list by connecting to the Simulink 3D Animation host. This is the computer on which the Simulink 3D Animation software is currently running. You do not need a VRML-enabled Web browser to display this page.
Note that a virtual world appears on this list in your Web browser only if the vrworld Description property contains a string. If this property is empty for a virtual world, that world is not accessible from the remote host. The simplest way to set a world description is to define the virtual world VRML file WorldInfo node and fill in the title field for that node. You can set up the WorldInfo node to look like the following:
WorldInfo {
title "My First World"
info [ "Author: XY" ]
}
The vrworld object uses the title string in the VRML file for the Description property of the vrworld object. You can change this property with the Simulink 3D Animation MATLAB interface (vrworld/set).
The following procedure describes how to connect to the Simulink 3D Animation host:
At the MATLAB command prompt, type
vrbounce
The VR Bouncing Ball demo is loaded and becomes active.
Open your VRML-enabled Web browser. In the address line of the browser, type
http://localhost:8123
Note To connect to the main HTML page from a client computer, type http://hostname:8123, where hostname is the name of the computer on which the Simulink 3D Animation software is currently running. |
The following page is loaded and becomes active.
The main HTML page for the Simulink 3D Animation product lists the currently available (active) virtual worlds. In this example, the VR Bouncing Ball virtual world appears as a link.

The VR Bouncing Ball virtual world appears in your Web browser.

From the main HTML page, you can select one of the listed available worlds or click the reload link to update the status of the virtual worlds supported by the software. This page does not require the VRML capabilities from the browser; it is a standard HTML page. Nevertheless, when you click one of the virtual world links in the list, the browser has to be VRML-enabled to display the virtual world correctly and to communicate with the Simulink 3D Animation product.
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. This means you need to 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 might be useful for remote computing, presentation of the results over the Web, or in situations where it is desirable to distribute 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 the blaxxun Contact plug-in. In this 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
vrtut1
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 VRML viewer also opens with a 3-D model of the virtual world associated with the model.
In the VRML viewer, select the Simulation menu Block Parameters option.
A Parameters: VR Sink dialog box opens.

On the client computer, open your VRML-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 192.168.0.1, enter
http://192.168.0.1:8123
To determine your IP address on a Windows system,
Click Start. Click Run. Type cmd, and enter ipconfig.
To determine your IP address on a UNIX system, type the command
ifconfig device_name
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 ipconfig.
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 Start.
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.
![]() | Associating a Virtual World with a Simulink Block | Working with VRML Sensors | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |