Java Reference
In-Depth Information
accordingly, leading to an appropriate translational movement of the associated objects. A
string variable is also changed to correspond to the type of movement.
In Figure 24, another behavior is set up to detect the change in the movement by en-
abling it to be triggered whenever the transform group targetTG leading to the movement
is changed. The processStimulus method of this behavior does nothing but just print out a
relevant message based on the modified string, which gives information on the movement
type.
It is worthwhile noting that, for obvious reasons of good programming practice, the
system will not allow the detection of a transform change in the same behavior for the
transform.
platform entry and exIt events
Using the WakeupOnViewPlatformEntry and WakeupOnViewPlatformExit criteria, one
can detect if the viewing platform is entering or leaving a certain volume. This will be
useful to decide if there is a need to carry out processing that may be specific to a particular
volume.
Note that there is a minor but significant difference between these two criteria on the
platform with WakeupOnActivation and WakeuponDeactivation. Specifically, for the latter
two criteria, which deal with objects and the platform in the virtual world, intersection of
the activation volume with the scheduling regions of the relevant objects will result in the
event triggering. On the other hand, WakeupOnViewPlatformEntry and its companion do
not require any object in the virtual universe. Instead, a certain bound needs to be passed
when the wakeup criterion is set up. Once this bound overlaps with the viewing platform,
appropriate triggers will be generated.
The usage of WakeupOnViewPlatformEntry and WakeupOnViewPlatformExit is given
in Figure 25, whereas Figure 26 gives a simple example where two sets of bounds are set
Figure 25. WakeupOnViewPlatformEntry and WakeupOnViewPlatformExit
WakeupOnViewPlatformEntry(Bounds region)
// Constructs a new WakeupOnEntry criterion.
WakeupOnViewPlatformExit(Bounds region)
// Constructs a new WakeupOnExit criterion.
Bounds getBounds()
// Return the bound specified.
Search WWH ::




Custom Search