Main Content

Set Viewpoints

Visitors to your virtual world navigate in an environment that you create for them, using navigation methods allowed by the viewer (Walk, Examine, Fly). It is useful to set up in the world several locations, places of interest you want to point the visitors to. These locations are called viewpoints. Visitors can browse through them, carrying out a guided tour you prepared for them, gaining the visual information you consider important in your model.

When entering a world, your are placed at the first Viewpoint node encountered in the file. It is especially important to define this viewpoint carefully as the most interesting entry point.

Each virtual world has as many viewpoints as you define for it. You can define viewpoints in the virtual world through your chosen editor or through the Simulink® 3D Animation™ viewer.

Defined viewpoints can be:

  • Static — usually created at the top level of the virtual world object hierarchy or as children of static objects (Transforms).

  • Dynamic — created as children of moving objects (objects driven from MATLAB®/Simulink) or linked to them using the VRML ROUTE mechanism.

    Dynamic viewpoints allow you to create interesting effects like view at the driving range from the view of the driver.

Define Viewpoints

You can add new viewpoints to the virtual world through the menu bar or toolbar. You can start the simulation before creating viewpoints. This procedure assumes that the model is not currently running.

  1. Select a Simulink 3D Animation example and type that example name in the MATLAB Command Window.

    The Simulink model is displayed. Also, by default, the Simulink 3D Animation viewer for that model is loaded and becomes active. If the viewer is not displayed, double-click the VR Sink block in the Simulink model.

    In the Simulink 3D Animation viewer, the default viewpoint for this model is View from top.

  2. From the menu bar, choose the Viewpoints > View on Earth.

  3. In the viewer window, navigate to a random position in the scene.

  4. Select the ViewpointsCreate Viewpoint.

  5. For the Name parameter, enter a unique and descriptive name for the viewpoint.

  6. Specify the placement of the viewpoint. Set Placement to Child of the root. This option makes the viewpoint a static one.

    The availability the Placement parameter depends on the current viewpoint. If the current viewpoint is at the top hierarchy level in the virtual world (one of the children of the root), the parameter is grayed out. In this case, it is only meaningful to create the viewpoint at the same top hierarchy level.

  7. To make the new viewpoint the current viewpoint for the view, select Jump to new viewpoint immediately and click OK. If you do not select this option, you still create a viewpoint, but you remain bound to the current viewpoint, not to the new viewpoint.

  8. Save the file with the new viewpoint, using FileSave As. If you do not save the file, the new viewpoint is lost during simulation.

  9. Simulate the model by selecting Simulation Start. Observe the motion of the planets from the new, static viewpoint. Then stop the simulation.

  10. Create another viewpoint.

  11. Create a viewpoint at the same level in the virtual world object hierarchy as the child of the parent transform of the current viewpoint. Set Placement to Sibling of the current viewpoint. The local coordinate system of the parent transform defines the new viewpoint coordinates. As a result, the new viewpoint moves with the parent transform. The new viewpoint also keeps the position relative to the transform (offset) that you first defined by navigating somewhere in the space from the current viewpoint.

    Note

    If the current viewpoint is at the top hierarchy level in the virtual world (one of the children of the root), the Placement field is grayed out. In this case, it is only meaningful to create the viewpoint as a static one at the same top hierarchy level.

  12. Make the new viewpoint the current viewpoint for the viewer. Select Jump to new viewpoint immediately and click OK. If you do not select this option, you still create a viewpoint, but you remain bound to the current viewpoint, not to the new viewpoint.

  13. Save the file with the new viewpoint. If you do not save the file, the new viewpoint is lost during simulation.

  14. Simulate the model. Observe that the relative position between the new viewpoint and Earth remains the same. The new viewpoint moves together with its parent object Earth transform.

Reset Viewpoints

You can reset your position in a scene to the initial default or current viewpoint position through the menu bar, toolbar, navigation panel, or keyboard shortcut keys.

  • From the menu bar, use the Viewpoints menu Return to viewpoint option to return to the initial position of the current viewpoint. Alternatively, from the toolbar, select Return to viewpoint button to return to the initial position of the current viewpoint.

  • From the navigation panel, click the Go to default viewpoint control to return to the default viewpoint of the virtual world. Alternatively, from the menu bar, use the Viewpoints menu Go to Default Viewpoint option to return to the default viewpoint of the virtual world.

  • From the keyboard:

    • To return to the default viewpoint of the virtual world, press the Esc key.

    • To return to the initial position of the current viewpoint, press the Home key.