Nov 11, 2015

Java 3D

yoyoBG = new BranchGroup();
                        // Make the apperance
 Appearance app = new Appearance();
            ColoringAttributes ca = new ColoringAttributes();
            ca.setColor(0.0f,1.0f,0.5f);
            app.setColoringAttributes(ca);
            //Start position
translate.set(new Vector3f(0.1f, 0.15f, 0.2f));
            TransformGroup  TGT = new TransformGroup(translate);
            BG.addChild(TGT);
            //Rotate
            rotate.rotZ(Math.PI*1.0d);
           TransformGroup  TGR = new TransformGroup(rotate);
            //Create the Cylinder
            Cylinder cy = new Cylinder(0.1f, 0.02f);
cy.setAppearance(app);
TGR.addChild(cy);
TGT.addChild(TGR);
            //Create the Cone
            Cone co1 = new Cone(0.1f, 0.2f);
            co1.setAppearance(app2);
            yoyoTGR7.addChild(co1);
            yoyoTGT7.addChild(yoyoTGR7); //Give the object value in main object value
            //Create the Cone
Sphere sp1=new Sphere(0.15f);
Sp1.setApperance(app3);
yoyoTGT11.addChild(sp1);
yoyoTGT7.addChild(yoyoTGR11); //Give the object value in main object value



No comments:

Post a Comment