float rotation;
Transform3D Transform3DA= new Transform3D();
Transform3DA.rotY(Math.toRadians(rotation));
TransformGroup TransformGroupA = new TransformGroup();
TransformGroupA.setTransform(Transform3DA);
Sphere sphere = new Sphere();
TransformGroupA.addChild(sphere);
TransformGroupA.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
(new Thread(){@Override public void run(){while(!isInterrupted()){
////////////////////////////////////////////////
rotation = rotation + 0.005f;
Transform3DA.rotY(Math.toRadians(rotation);
TransformGroupA.setTransform(Transform3DA);
System.out.println("Siehste, alle 50 millisekunden");
////////////////////////////////////////////////
try{sleep(50);}catch(InterruptedException e){interrupt();}}}}).start();
//IrgendeineBranchGroup.addChild(TransformGroupA);
das geht damit leider nicht, das ist das blöde daran, aber versuchs mal in einem Thread wie hier:
Java:float rotation; Transform3D Transform3DA= new Transform3D(); Transform3DA.rotY(Math.toRadians(rotation)); TransformGroup TransformGroupA = new TransformGroup(); TransformGroupA.setTransform(Transform3DA); Sphere sphere = new Sphere(); TransformGroupA.addChild(sphere); TransformGroupA.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); (new Thread(){@Override public void run(){while(!isInterrupted()){ //////////////////////////////////////////////// rotation = rotation + 0.005f; Transform3DA.rotY(Math.toRadians(rotation); TransformGroupA.setTransform(Transform3DA); System.out.println("Siehste, alle 50 millisekunden"); //////////////////////////////////////////////// try{sleep(50);}catch(InterruptedException e){interrupt();}}}}).start(); //IrgendeineBranchGroup.addChild(TransformGroupA);
winkel = startWinkel * (1 - alpha.getValue()) + endWinkel * alpha.getValue();