Java Reference
In-Depth Information
shapes for a variety of purposes. As a simple example of picking behavior, Figure 1 shows
snapshots in an application where the user uses the mouse to pick up a cube and moves it
to a new position through a mouse dragging operation.
In this chapter, we will discuss how the picking behavior class in Java 3D can be made
use of to create interesting customized dynamical picking interaction with any specific vi-
sual object. We will start in the next section with the use of some standard picking behavior
classes, before embarking on to discuss how custom picking classes can be constructed to
suit specific applications.
pickrotatebehavior, picktranslatebehavior, and
pickZoombehavior
The standard PickRotateBehavior, PickTranslateBehavior, and PickZoomBehavior classes in
Java 3D include capabilities that allow the user to interactively pick and then rotate, translate,
and zoom visual objects in a 3D scene (Nakano, Sato, Matsuo, & Ishimasa, 2000).
Figures 2 to 4 give the code segment and result snapshots in a simple example illustrat-
ing the use of these three classes in a picking behavior involving a sphere and a color cube.
The interaction includes translation, rotation, and zooming.
In this example, the objects are immersed in a landscape matrix so that it will be easier
to visualize how the objects are being moved or changed as they are picked by using the
mouse. Specifically, dragging a visual object while pressing the left mouse button will make
the picked object rotate, doing so with the right button pressed will translate the object, and
dragging the object with the middle button pressed will make the object zoom in or out.
Note that the picking behavior is unique for individual objects in the same scene. Also,
Enable_Pick_Reporting is set for the appropriate transform groups.
pIckInG classes In General
The picking classes described in the last section are relatively easy to use and can provide
some standard interaction between visual objects and the user. However, the interaction
may be too rigid to cater to every scenario. Examples are knobs that only allow the user to
turn and buttons that can only be pressed as they are pushed in the 3D world.
To satisfy requirements such as those mentioned in the examples, there are very often
needs to create customized picking behaviors for certain specific objects in applications.
We will now discuss techniques and methods that can be used for constructing customized
picking classes for this purpose.
Before discussing details and giving illustrating examples in the following sections, we
would first like to highlight a few general categories of picking classes and describe how
Search WWH ::




Custom Search