Hi Emanuel,

   The previous reply is based on the code in the mail. I didn't
go back the archive and search the original email.

Here is from the original email:

   if(running&&(theCriteria instanceof WakeupOnElapsedTime))
        {
          viewTransform.mul(moveTrans);

          viewTransform.get(viewTranslation);

          StarsTransform.setTranslation(viewTranslation);

          StarsTransformGroup.setTransform(StarsTransform);
          viewTransformGroup.setTransform(viewTransform);
        }

This does not apply to both cases. Since
the workaround mention in bug is

 public void processStimulus(Enumeration criteria) {
    Modify Object transform as in RotationInterpolator
    Modify Camera View point using object transform
}

But the above code snippet does not set view transform
base on object transform so I guess your code is ok.

In the original email you mention:

"The strange thing about this is that this problem only shows up, when
the translational part of the transforms becomes larger."

Check out if the following bug match:
4760871 -  Jitter when objects are translated far from origin.


- Kelvin
---------------
Java 3D Team
Sun Microsystems Inc.


Emanuel Brzostowski wrote:
Hi Kelvin

Slowly i start to get mad ;)
here is why:
You wrote:

Besides, I'm not sure why you need to get
SchedulingInterval back and do different things,
if you are really doing this in single behavior it should be

        viewTransform.get(viewTranslation);
        StarsTransform.setTranslation(viewTranslation);
        StarsTransformGroup.setTransform(StarsTransform);
        viewTransformGroup.setTransform(viewTransform);

instead of

      if(getSchedulingInterval()==1)
      {
        viewTransform.get(viewTranslation);
        StarsTransform.setTranslation(viewTranslation);
        StarsTransformGroup.setTransform(StarsTransform);
      }
      else
      {
        viewTransformGroup.setTransform(viewTransform);
      }

The code you suggested first, was exactly that, what i tried first - to no
avail.
I also modified the stimulus for the behavior to be
WakeupOnEllapsedFrames(0) - No sucess.

To clarify my problem, i first include a quote, taken from the ApiDoc about
the
Behavior class:

"[...]A typical behavior will modify one or more nodes or node components in
the scene graph. These modifications can happen in parallel with rendering.
In general, applications cannot count on behavior execution being
synchronized with rendering. There are two exceptions to this general rule:

  1.) All modifications to scene graph objects (not including geometry
by-reference or texture by-reference) made from the processStimulus method
of a
single behavior instance are guaranteed to take effect in the same rendering
frame.

  2.) All modifications to scene graph objects (not including geometry
by-reference or texture by-reference) made from the processStimulus methods
of the
set of behaviors that wake up in response to a WakeupOnElapsedFrames(0)
wakeup condition are guaranteed to take effect in the same rendering
frame.[...]"

The "workaround" suggested for the (non-)bug #4332793 clearly references
Statement 2.)

But the problem i have, obviously references Statement 1.) !
(Two transforms in ONE behavior, not reflected in the same frame).
Plz have a look at the code-snippets in my first posting, you will see that
the premises
of Statement 1.) are met in my case. So the conclusion have not to be be
false,
otherwise the implication in Statement 1.) is proven to be WRONG.
I believe, the testcase in my first posting proves this and thus, there
seems to be another bug with the Behavior.

It would be nice, if you could check this again, and hopefully proving me
wrong
(and offer a solution if so)  ;)

- emanuel











Hi Emanuel,

    The workaround and new API apply when several
behaviors wakeup EVERY frame. i.e. several behavior
use wakeupOnElapsedFrame(0) and we need to order them
appropriately.

   However in your case there is two behaviors,
wakeupOnElapsedTime(10) which postId(0) to trigger another
wakeupOnBehaviorPost() so above things will not apply here.


Besides, I'm not sure why you need to get
SchedulingInterval back and do different things,
if you are really doing this in single behavior it should be




        viewTransform.get(viewTranslation);
        StarsTransform.setTranslation(viewTranslation);
        StarsTransformGroup.setTransform(StarsTransform);
        viewTransformGroup.setTransform(viewTransform);


instead of

      if(getSchedulingInterval()==1)
      {
        viewTransform.get(viewTranslation);
        StarsTransform.setTranslation(viewTranslation);
        StarsTransformGroup.setTransform(StarsTransform);
      }
      else
      {
        viewTransformGroup.setTransform(viewTransform);
      }

- Kelvin


Emanuel Brzostowski wrote:

Hi Kelvin



Check out evaluate of bug
4332793 -
View transform & object transform not synchronize in a single behavior

I already found this bug in database before, but it is not exactly what
i

need.
In the description of the problem in the bug above two behaviors are
involved
where both should be executed in the same time.
But ok, i tracked it down to find the possible soultion (forcing the
order

of first running the interpolator and after that running the
camera-behavior

by setting the sheduling intervalls).
So i modified the testcase (in a IMHO strange way), ensuring that my
object

transform
is executed before the view-transform.
I've done this with another two behaviors wich react on the same stimuli
(WakeupOnBehaviorPost) and so wake up the same time.
These behaviors got sheduling-intervalls to reflect their priority
(first

update transform of StarsTransformgroup and secondary update the
view-transformgroup).
BUT same problem as before: rendered frame does'nt shows up both
transforms

:(

the following is some of the code i produced (unchanged parts cut out):
plz have a look, its short ;)
===============================
.
.
.
 Canvas3D canvas3d = new Canvas3D(null);
 Transform3D viewTransform;
 TransformGroup viewTransformGroup;
 Transform3D StarsTransform;
 TransformGroup StarsTransformGroup;
 View myView;
 timedBehavior behav;
.
.
.
 public BranchGroup buildViewBranch(Canvas3D c)
 {
  .
  .
  .
   // this behavior posts the id
   behav = new timedBehavior();
   behav.setSchedulingBounds(bounds);
   viewTransformGroup.addChild(behav);

   // following behaviors wake up on the posted id
   calledBehavior LowSIBehav = new calledBehavior();
   LowSIBehav.setSchedulingBounds(bounds);
   LowSIBehav.setSchedulingInterval(1);
   viewTransformGroup.addChild(LowSIBehav);

   calledBehavior HighSIBehav = new calledBehavior();
   HighSIBehav.setSchedulingBounds(bounds);
   HighSIBehav.setSchedulingInterval(5);
   viewTransformGroup.addChild(HighSIBehav);
   .
   .
   .
   return(viewBranch);
 }
.
.
.
 public class timedBehavior extends Behavior
 {
   public boolean running = false;
   WakeupCriterion[] wakeConditions;
   WakeupOr oredConditions;
   AWTEvent ae[];
   Transform3D moveTrans;
   Vector3d viewTranslation;


   public void initialize()
   {
     moveTrans = new Transform3D();
     moveTrans.set(new Vector3d(0.0, 0.0, 10000.0));
     viewTranslation = new Vector3d();

     wakeConditions = new WakeupCriterion[3];
     wakeConditions[0] = new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED);
     wakeConditions[1] = new WakeupOnAWTEvent(KeyEvent.KEY_RELEASED);
     wakeConditions[2] = new WakeupOnElapsedTime(10);
     oredConditions = new WakeupOr(wakeConditions);
     wakeupOn(oredConditions);
   }


   public void processStimulus(Enumeration criteria)
   {
     WakeupCriterion theCriteria;
     if(criteria.hasMoreElements())theCriteria =
(WakeupCriterion)criteria.nextElement();
     else
     {
       wakeupOn(oredConditions);
       return;
     }

     if(theCriteria instanceof WakeupOnAWTEvent)
     {
      ae = ((WakeupOnAWTEvent)theCriteria).getAWTEvent();
      if(ae[0].getID()==KeyEvent.KEY_PRESSED) running = true;
      else if(ae[0].getID()==KeyEvent.KEY_RELEASED) running = false;
     }
     else
     {
       if(running&&(theCriteria instanceof WakeupOnElapsedTime))
       {
         viewTransform.mul(moveTrans);
         this.postId(0);
       }
     }
     wakeupOn(oredConditions);
   }
 }


 public class calledBehavior extends Behavior
 {
   WakeupCondition wakeCondition;
   Vector3d viewTranslation;

   public void initialize()
   {
     viewTranslation = new Vector3d();
     wakeCondition = new WakeupOnBehaviorPost(behav, 0);
     wakeupOn(wakeCondition);
   }


   public void processStimulus(Enumeration criteria)
   {
     //ensure, behavior where this condition is true runs first
     if(getSchedulingInterval()==1)
     {
       viewTransform.get(viewTranslation);
       StarsTransform.setTranslation(viewTranslation);
       StarsTransformGroup.setTransform(StarsTransform);
     }
     else
     {
       viewTransformGroup.setTransform(viewTransform);
     }
     wakeupOn(wakeCondition);
   }
 }
===============================

--
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr f�r 1 ct/ Min. surfen!

===========================================================================
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".
===========================================================================
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".

Reply via email to