> From: "Shawn Kendall" <[EMAIL PROTECTED]> > I don't understand this technique completely. The docs on Behavior.postID() > are very terse. > > "Post the specified Id. Behaviors use this method to cause sequential > scheduling of other behavior object" The basic idea is that Behavior.postID() is a way of generating an arbitrary wakeup event. One usage of this mechanism is to put an event from outside the J3D behavior mechanism into the J3D event stream, but the interface is alot more general than that. The reason to put outside events into the behavior event stream is that J3D ensures that all the scene graph changes made in a call to Behavior.processStimulus() will appear the same frame. Without the behavior mechanism, there is no way to force the changes to appear on the same frame. The behavior post interface works like this: Calling Behavior.postId() is an event which can wake up Java3D behaviors just like an AWTevent or new frame. Behaviors register to be woken up by Behavior.postId() by adding a WakeupOnBehaviorPost object to their wakeup criteria. There are two sides to the wakeup, the triggering event and the wakeup criteria. If the event meets the criteria, processStimulus gets called on the behavior. The event has a reference to the behavior that postId() was called on and the postId passed to postId(). The wakeup criteria has a target behavior and a target postId. The event meets the criteria if the behavior matches the target behavior and the postId matches the target postId. A target behavior of null matches all behaviors, a target postId of 0 matches all postIds. For example, to make a group of scene graph changes appear together, make a behavior to do the update, call it updateBehavior. Make updateBehavior wakeup on a WakeupOnBehaviorPost with the the target behavior set to updateBehavior and the target postId set to 0. Add updateBehavior to your scene graph. After updateBehavior.postId(postId) is called, the behavior scheduler will call updateBehavior.processStimulus() with a WakeupOnBehaviorPost with the postId. There are other ways to use Behavior.postId(). For example, you could make a "reset" event which several behaviors could listen for. To do this, define an postId which means "reset" (i.e. postId == -1 means "reset). Have each of the behaviors register a WakeupOnBehaviorPost with a null behavior and the "reset" postId. Calling Behavior.postId() with the "reset" postId will make processStimulus() be called on the behaviors with a WakeupOnBehaviorPost with the triggering behavior and the "reset" postId. Doug Gehringer Sun Microsystems =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".