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