Group Example 2

Source


#VRML V2.0 utf8

Viewpoint {
  position 0 2 10
  orientation 0 1 0 0
}

#### Transform is added to combine the Group nodes CONEBOX and SPHEREBOX
####  so that they can be rotated as a single unit

Transform {
  translation 2 0 0
  children [

    DEF CONEBOX Group {
       children [
         Transform {
           translation   1 1 0
           children 
             Shape {
                appearance Appearance {
                   material Material {
	             diffuseColor     0 1 0
	           }
                }
                geometry Cone{ 
	          height 2.0
	          bottomRadius 1.0
                }
             }
         }

         Transform {
           translation   -1 1 0
           children  
             Shape {
                appearance Appearance { 
                   material Material {
                     diffuseColor      0 0 1
                   }
                }
                geometry Box {
 	           size 1 2.0 1
                }
             }
         }
       ]
    }


    DEF SPHEREBOX Group {
        children [
         Transform {
           translation   1 3.5 0
           children 
             Shape {
                appearance Appearance {
                   material Material {
                     diffuseColor    0.8 0.2 0.4
                   }
                }
                geometry Sphere{
                  radius 1.0
                }
             }
         }

         Transform {
           translation   -1 3.5 0
           children
              Shape {
                appearance Appearance {
                   material Material {
                     diffuseColor      0.2 0.4 0.2
                   }
                }
                geometry Box {
                   size 1 1 1
                }
             }
         }
               
       ]
     } 

  ]
}