Java Reference
In-Depth Information
Figure 1. Basic view branch graph showing view platform transform
keyboard navIGatIon usInG keyboardbehavior
The keyboard is perhaps still the simplest and the most comprehensive hardware available
for navigation in a 3D virtual world. To use this hardware in Java 3D, two approaches can be
adopted. The most straightforward but rather rigid approach is to make use of the existing
KeyNavigatorBehavior utility class, which is summarized in Figure 2. On the other hand,
for more flexible behavior and performance, more programming effort can be spent to define
the behavior for each individual key to suit a specific application. The former approach will
be dealt with in this section, while the latter will be discussed in the next section.
Essentially, the use of the KeyNavigatorBehaviour utility class requires the following
steps to be carried out:
Create a KeyNavigatorBehavior object for the transform group of interest.
Add the KeyNavigatorBehavior object to the scene graph.
Define appropriate bounds for the KeyNavigatorBehavior object.
Figure 3 shows the code segment for a simple example in the use of the KeyNavigator-
Behavior class for navigation. Note that the navigation functionalities of the various keys
are provided in Figure 2.
Search WWH ::




Custom Search