This tutorial will show you how to create subwindows with separate views of the scene. In this example we will load a gallery model and create two subwindows, one that shows a birds-eye-view of the scene and another which acts as a rear-view mirror.
Note: this content is discussed in more detail in the reference section.
This tutorial will show you how to create subwindows with separate views of the scene. In this example we will load a gallery model and create two subwindows, one that shows a birds-eye-view of the scene and another which acts as a rear-view mirror.
Click here for instructions on creating an empty Vizard script.
If you have trouble getting the code in this tutorial to work, you can find the complete example script windowsAndViews.py in the \tutorials\views directory.
Add the following initial code to your script:
import viz
viz.go()
viz.add('gallery.ive')
This simply adds the gallery model to the world.
Now lets add the subwindow which will act as the birds-eye-view. Add the following code to the end of your script:
BirdEyeWindow = viz.addWindow()
Now run your script.
You will see the gallery as usual, but there will be a smaller window in the upper right corner. For now the subwindow shows the exact same view as the main window. To have it show a birds-eye-view we need to create a viewpoint for the subwindow.
A viewpoint controls where the camera is positioned and pointed at. Add the following code to create a new viewpoint:
BirdEyeView = viz.addView()
If you run your script nothing will have changed, that is because we need to assign the new viewpoint to the subwindow. The following code will tell vizard to attach the new viewpoint to our subwindow:
Now that the viewpoint is attached to the subwindow we need to place it above the scene and have it point downward.
The following code will set the position of the viewpoint at a height of 9 meters and rotate it so that it points straight down:
Run your script to see the new viewpoint.
|
|
Adding a bird's eye view
|