This tutorial will teach you how to create On-The-Fly (OTF) geometry and vizshape models. OTF objects are useful for dynamically creating simple geometry like lines, points, and squares. The vizshape library provides commands for building more complex shapes likes boxes, spheres, and pyramids.
In this example, we'll create a game where the user needs to navigate a maze and find hidden shapes. The viewpoint path will be drawn dynamically using lines strips in a bird's eye view of the maze.
This content is discussed in more detail in the reference section.
If you have trouble getting the code in this tutorial to work, you can find the complete example script onTheFly.py in the \tutorials\3Dmodels directory.
Add the following initial code to create the maze environment and a sub-window with a bird's eye view of the scene.
Next, let's add an OTF line strip object. This will allow us to create a series of connected lines to represent the user's movement. In the code below, the first line starts the creation of the object and defines it's type. The third line ends it's creation and specifies that it will be drawn to the BirdsEyeWindow. OTF objects can be rendered to the screen, as it is here, and to the 3D world.
Every OTF object includes the viz.startLayer and viz.endLayer commands. In between these commands various properties of the object are specified (e.g vertex position, color, size). In this case, the vertices are not created but their color is set. They will be added dynamically as the user moves through the maze in the next section.