Collision Example 2

Source


#VRML V2.0 utf8

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

DirectionalLight {
  direction 0 -1 0
}

#### The collide field is set to FALSE for the cone and box ####

Collision {

  collide  FALSE

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

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


#### Here a Group or Transform node could be used in place of Collision 
####  because by default all objects in a scene are collidable.

Collision {
  children [
    Transform {
      translation   2 1.5 0
      children
        Shape {
           appearance Appearance {
              material Material {
                diffuseColor      1 0 0 
              }
           }
           geometry Sphere {
	      radius 1.0
           }   
        }
    }

#### FLOOR ####
    Transform {
      translation   0 0 0
      children
        Shape {
           appearance Appearance {
              material Material {
                diffuseColor      0.5 0.5 0.9
              }
           }   
           geometry Box {
              size 15 0.1 15
           }   
        }
    }

  ]
}