Animation / Rotation Problem
Hello!
I have a vrml -file imported in java3d. This still works. I also can pick
the different objects.
Now I will rotate one object, called "Flagge"
The Problem is, that this object get minimized and doesn't rotate.
It moves from up to down. Where is my problem?
Thanks a lot!
privateclass PickObjectsListenerimplements MouseListener{
publicvoid mouseClicked(MouseEvent arg0){
pickC.setShapeLocation(arg0);
PickResult pickResult = pickC.pickClosest();
if (pickResult !=null){
//System.out.println("Closest PickResult: " + pickResult);
Node actualNode;
actualNode = pickResult.getObject();
if (actualNode.getUserData() !=null){
String name = (String) actualNode.getUserData();
Hashtable namedObjects = s.getNamedObjects();
System.out.println("Object " + name);
if (name.equals("Fahnenmast")){
System.out.println("Fahnenmast");
a.flagge((TransformGroup)namedObjects.get("Flagge"),getGehisst());
/*
Transform3D xAxis=new Transform3D();
xAxis.rotZ(Math.PI*0.5d); //90癲rehen,Animation nur in x_Achse
Alpha upRamp = new Alpha( );
upRamp.setIncreasingAlphaDuration( 10000 );
upRamp.setLoopCount( -1 ); // loop forever
PositionInterpolator position = new PositionInterpolator(upRamp, (TransformGroup)namedObjects.get("leuchtturm"), xAxis, 0.0f, 1000.0f);
position.setSchedulingBounds(new BoundingSphere());
BranchGroup test = new BranchGroup();
test.addChild(position);
s.getSceneGroup().addChild(test);*/
Alpha upRamp =new Alpha( );
upRamp.setIncreasingAlphaDuration( 10000 );
upRamp.setLoopCount( -1 );// loop forever
RotationInterpolator mySpinner =new RotationInterpolator( upRamp, (TransformGroup)namedObjects.get("Flagge"));
mySpinner.setAxisOfRotation(new Transform3D());
mySpinner.setMinimumAngle( 0.0f );
mySpinner.setMaximumAngle( (float)(Math.PI * 2.0) );
mySpinner.setSchedulingBounds(bounds);
//Transform3D t3d = objAnsicht.getTransform();
// objAnsicht.addChild(mySpinner); Fehler: only a branchGroup node may be added
BranchGroup test =new BranchGroup();
TransformGroup transFormtest =new TransformGroup();
Transform3D tScale =new Transform3D();
tScale.setTranslation(new Vector3d(verschiebungXachse,verschiebungYachse,0));
transFormtest.setTransform(tScale);
transFormtest.addChild(mySpinner);
test.addChild(transFormtest);
s.getSceneGroup().addChild(test);
}
}
}
}

