Picking

Picking

Chi Chung Ko, Chang Dong Cheng
Copyright: © 2009 |Pages: 29
DOI: 10.4018/978-1-59904-789-8.ch009
OnDemand:
(Individual Chapters)
Available
$37.50
No Current Special Offers
TOTAL SAVINGS: $37.50

Abstract

The last two chapters have discussed how animation and interaction can be created in Java 3D to increase visual impact, to show object dynamics and hidden views, and to allow the user to interact with the objects in a virtual 3D universe (Emoto et al., 2001, Shyamsundar & Gadh, 2001). Our discussion has been carried in a general tone through the use of the behavior class to capture all types of events to cater to all possibilities. However, it is common that interaction with 3D objects in many applications involves the user to pick up relevant objects and change its positions, angles, and even texture and 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 visual 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.
Chapter Preview
Top

Introduction

The last two chapters have discussed how animation and interaction can be created in Java 3D to increase visual impact, to show object dynamics and hidden views, and to allow the user to interact with the objects in a virtual 3D universe (Emoto et al., 2001, Shyamsundar & Gadh, 2001). Our discussion has been carried in a general tone through the use of the behavior class to capture all types of events to cater to all possibilities.

However, it is common that interaction with 3D objects in many applications involves the user to pick up relevant objects and change its positions, angles, and even texture and 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.

Figure 1.

Illustration of picking behavior when the user picks and moves the cube

978-1-59904-789-8.ch009.f01

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 visual 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.

Top

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 illustrating the use of these three classes in a picking behavior involving a sphere and a color cube. The interaction includes translation, rotation, and zooming.

Figure 2.

First code segment for PickBehaviour.java

978-1-59904-789-8.ch009.f02
Figure 4.

Third code segment and result snapshoots for PickBehaviour.java

978-1-59904-789-8.ch009.f04

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.

Figure 3.

Second code segment for PickBehaviour.java

978-1-59904-789-8.ch009.f03
Top

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.

Complete Chapter List

Search this Book:
Reset