Java Reference
In-Depth Information
Since behavior is crucial and more difficult to realize, the next few sections will provide
some more details on the overall design and implementation of the important behaviors
for the application.
navIGatIon behavIor
This is crucial for allowing the user to move or walk around in the virtual world and is a
very important aspect in the design of any 3D system. In the original Java 3D API, some
basic navigating functions are provided. This is through the use of the class KeyNavigator-
Behavior and is based on keystrokes. The drawback is that it is not a natural interface, as
many keys are involved and it is not possible to change the movement step size. For most
users who are not familiar with the many keys involved, it will be much easier if only the
mouse is needed for navigation by clicking or pressing some movement icons.
With this consideration, a more sophisticated navigating system has been designed and
developed. In this system, navigation can be done by using either the mouse or the keyboard.
Specifically, the position and direction of the view platform or viewpoint can be changed
by simply using the mouse to press the appropriate icons of Figure 6.
As shown in Figure 6, navigation using the designed interface can be done by using three
control objects: a navigating speed slider, a translation, and a rotation icon. To change the
user's “walking” speed through the 3D virtual laboratory, the navigating speed slider can
be adjusted. This will change the delays used in the main processing steps of the navigating
function. The icon with six straight arrows allows the user to move in a straight translational
manner. Pressing the ball in the center will reset the viewpoint to its initial position. The
other icon with four curved arrows allows the user to rotate around the current position.
The ball in the center will reset the viewpoint to a horizontal one.
As given in Appendix G, navigation and collision detection are implemented in the
following manner.
1.
Navigationwithmouse: When a mouse click is detected on the navigation icons, the
system will activate the MousePressed function in Section G.17. This will find out
the selected navigation direction and pass this information to a variable buttonvalue.
The main processStimulus function in Section F.14 is then invoked to calculate the
position and orientation parameters for the movement.
2.
Navigationwithkeys: When an appropriate navigation key is pressed, the system
will invoke the main processStimulus function in Section G.14. The processKeyEvent
function in Section G.13 will be invoked to calculate the position and orientation
parameters for the movement.
3.
Movement: Once the position and orientation parameters for the movement have been
obtained, the code in Section G.11 or 9 is then invoked to implement the translation
Search WWH ::




Custom Search