Virtual Reality Toolbox    

Changing the Virtual World Associated with a Simulink Block

Sometimes you might want to associate a different virtual world with a Simulink model or connect different signals.

After you associate a virtual world with a Simulink model, you can select another virtual world or change signals connected to the virtual world. This procedure assumes that you have connected the Simulink model with a virtual world. See Adding a Virtual Reality Toolbox Block:

  1. Double-click the VR Sink block in the model.
  1. The Block Parameters: VR Sink dialog box opens.

  1. Click the Browse button. The Select World dialog box opens. Find the directory <matlab root>\toolbox\vr\vrdemos. Select the file vrtkoff2.wrl, and click Open.
  2. In the Block Parameters: VR Sink dialog box, click Apply.
  1. A VRML tree appears on the right side. Simulink associates a new virtual world with the model.

  1. On the left of the Plane Transform node, click the plus sign square.
  1. The Plane Transform tree expands. Now you can see what characteristics of the plane you can drive from Simulink. This model computes the position.

  1. In the Plane Transform tree, select the translation field check box. Clear the rotation field check box. Click OK.
  1. The VR Sink block updates and changes to just one input, the Plane translation. The Virtual Reality block is ready to use with the new parameters defined.

  1. Verify that the correct output is connected to your VR Sink block. The output from the VR Signal Expander should be connected to the single input.
  2. Run the simulation again and view the new model in the viewer.

  Adding a Virtual Reality Toolbox Block Using the Simulink Interface