I am using Java3d (1.2) in order to programm a Doom-like for a study
project. After some problems solved, I now have a big one.
In order to shoot, I want to use a PositionInterpolator with a beam as
target (LineArray). This LineArray is created in a Behavior responding
to a Mouse MOUSE_PRESSED, put in a TransformGroup and then in a
BranchGroup, and finally added to the live BG (objRoot...), since only a
BG can be added to a live BG.
My problem is that the PositionInterpolator whose target is the TG takes
it from the position where I first set it (10,0,10 for ex) and put it in
the origin (0,0,0); then the movement is executed...
So, it seems to me that the translation part of the PositionInterpolator
is not modifiable... I first though that the TG's one was used to set
the object's position, but in reality it doesn't!
I have tried many others situations (not in a behavior
Do you have a miracle for me?
//////////////////////////////////////////////////////////////////////
Part of my code:
vpTrans.getTransform(transform);
transform.get(rotation, translation);
// beam's creation
LineArray rayon = new LineArray(2, LineArray.COORDINATES |
LineArray.COLOR_3);
Point3d point= new Point3d(0.0d, 0.0d,-1.0d);
rotation.transform(point);
rayon.setCoordinate(0, new Point3d(0.0d, 0.0d, 0.0d) );
rayon.setCoordinate(1, point );
rayon.setColor(0, new Color3f(1.0f, 1.0f, 0.0f) );
rayon.setColor(1, new Color3f(1.0f, 0.0f, 1.0f) );
// position of the beam
Transform3D tr= new Transform3D();
tr.rotY(Math.PI/2.0f);
transform.mul(tr);
TransformGroup tgBalle= new TransformGroup(transform);
tgBalle.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// alpha of the following PositionInterpolator
Alpha alf= new Alpha();
alf.setLoopCount(10);
alf.setMode(Alpha.INCREASING_ENABLE);
alf.setIncreasingAlphaDuration(5000);
alf.setStartTime(System.currentTimeMillis());
// interpolator with bounds
PositionInterpolator posInter= new PositionInterpolator(alf, tgBalle,
transform, 0.0f, 10.0f );
BoundingSphere bouleP= new BoundingSphere( new Point3d(10.0f, 0.0f,
10.0f), 1000.0f);
posInter.setSchedulingBounds(bouleP);
// assemble scene graph
tgBalle.addChild( new Shape3D(rayon) );
BranchGroup bgBalle= new BranchGroup();
bgBalle.addChild(posInter);
bgBalle.addChild(tgBalle);
objRoot.addChild(bgBalle);
===========================================================================
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".