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
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
Dynamic — created as children of moving objects (objects driven from
MATLAB®/Simulink) or linked to them using the VRML
Dynamic viewpoints allow you to create interesting effects like view at the driving range from the view of the driver.
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.
Select a Simulink 3D Animation example and type that example name in the MATLAB Command Window. For example:
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
From the menu bar, choose the Viewpoints > View on Earth.
In the viewer window, navigate to a random position in the scene.
Select the ViewpointsCreate Viewpoint.
For the Name parameter, enter a unique and descriptive name for the viewpoint.
Specify the placement of the viewpoint. Set
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.
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.
Save the file with the new viewpoint, using FileSave As. If you do not save the file, the new viewpoint is lost during simulation.
Simulate the model by selecting Simulation Start. Observe the motion of the planets from the new, static viewpoint. Then stop the simulation.
Create another viewpoint.
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
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.
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.
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.
Save the file with the new viewpoint. If you do not save the file, the new viewpoint is lost during simulation.
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.
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.