Rotate a colorcube and stop when a value is 1

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Rotate a colorcube and stop when a value is 1

Davidave
Hey guys. I need your help one more time !

in my programm i am looking in front of a rotating colorcube. when a value "stop"  gets 1 i want to STOP the rotation. thats no problem so far! But when it stops it should show me the RED side of the  colorcube! how can i do that ?
here is some of my code!


Transform3D drehCube3D = new Transform3D();
                        TransformGroup drehGroup = new TransformGroup();
                        drehGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
                        TransformGroup tgdrehfinal = new TransformGroup();
                       
                        Vector3f v3DrehCube = new Vector3f(0f, 1f, 0f);
                        drehCube3D.setTranslation(v3DrehCube);
                        ColorCube drehbox = new ColorCube(0.3);
                        drehbox.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
                        drehGroup.setTransform(drehCube3D);
                        drehGroup.addChild(drehbox);
                       
                       
                        AlphadrehAlpha = new Alpha(1000,1000);
                       
                        rotint = new RotationInterpolator(AlphadrehAlpha, drehGroup );
                       
                       
                        rotint.setSchedulingBounds(new BoundingSphere());
                                                branch.addChild(rotint);
                       
                       
                        tgdrehfinal.addChild(drehGroup);
                        branch.addChild(tgdrehfinal);
                       
                        return branch;
                }




if ( stop == 1){
                                         AlphadrehAlpha.pause();
                                        System.out.println("yes");
                                                 
                                 }


i set my alpha 0nPause when stop gets 1 ! but NOW it stops at any point.  how can I say that it should stop at the right position(when i can see the red side)?



Reply | Threaded
Open this post in threaded view
|

Re: Rotate a colorcube and stop when a value is 1

gouessej
Administrator
What do you want to do? Do you want the cube to go on rotating until reaching the red side when stop == 1?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Rotate a colorcube and stop when a value is 1

Davidave
yes :D sorry for my bad english :D
Reply | Threaded
Open this post in threaded view
|

Re: Rotate a colorcube and stop when a value is 1

gouessej
Administrator
Instead of calling AlphadrehAlpha.pause() when stop == 1, just check whether stop == 1 and the rotation of the color cube is set to a value that shows the red side.
Julien Gouesse | Personal blog | Website