Virtual Reality Toolbox    

Displaying a Virtual World and Starting Simulation

This example explains how to display a simulated virtual world using the Virtual Reality Toolbox 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:

  1. In the MATLAB Command Window, type
  1. A Simulink window opens with the model of an automobile.

    A VRML viewer also opens with a three-dimensional model of the virtual world associated with the model.

  1. Arrange the viewer and Simulink windows on your screen so that they are both visible at the same time.
  2. In the Simulink window, from the Simulation menu, click Start.
  1. The simulation starts and, in the VRML viewer window, a car moves along the mountain road.

  1. Use the VRML viewer controls to move the camera within this virtual world while the simulation is running. For more information on the Virtual Reality Toolbox viewer controls, see Virtual Reality Toolbox Viewer.
  2. In the Simulink window, from the Simulation menu, click Stop.

Opening a Viewer Window

If you close the viewer window, you might want to reopen it:

  1. In the Simulink model window, double-click the VR Sink or VR Source block.
  1. A Block Parameters dialog box opens.

  1. Click View.
  1. 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 click View in the Block Parameters dialog box. This feature is particularly useful if you want to view one scene from many different viewpoints at the same time.


  Using the Simulink Interface View a Virtual World with a Web Browser on the Host Computer