Java Reference
In-Depth Information
Figure 2. Using KeyNavigatorBehavior
KeyNavigatorBehavior(TransformGroup targetTG)
// constructs a new key navigator behavior node that operates on the specified transform group.
// Override behavior's initialize method to setup wakeup criteria.
processStimulus(java.util.Enumeration criteria)
// Override behavior's stimulus method to handle stimulus event.
Rotate left
Rotate Right
Move forward
Move backward
Rotate up
Rotate down
Restore back clip distance (and return to the origin)
Reduce back clip distance
Return to center of universe
As can be seen from Figure 3, the TransformGroup for the ViewPlatform needs to be
retrieved before it can be appropriately changed as the user moves. Thus, we pass the relevant
SimpleUniverse object to the createSceneGraph () method in the code segment, and use it
to retrieve the TransformGroup containing the ViewPlatform in line 10. Line 12 creates a
new KeyNavigatorBehavior object and line 13 defines bounds for that object.
It should be emphasized that the main advantage of using KeyNavigatorBehavior is that
one can use some well-known pre-defined keystrokes for navigation. However, the main
disadvantage is that it may not be flexible enough for specific applications. In particular,
the rate of movement or the speed at which the user moves through the virtual world can-
not be changed.
user defIned keyboard navIGatIon
The requirement of user friendliness often dictates the use of custom defined key func-
tions in 3D navigation. This will involve detecting the relevant keys and making changes
to some transforms to give the effect of moving forward or backward, sidestepping left or
right, up or down, as well as turning left and right.
Search WWH ::

Custom Search