# # #[Prototype] , [SphereSensor] #
#ex-proto.wrl
# example of prototype and SphereSensor use

#VRML V2.0 utf8 
# Written By Fabiana
# Last Modified 06-Jan-97
## see more details in [details]

# in this example you have to drag the "spherecone" object with 
#  the mouse (clicking the right button). The mouse movement will 
#  be reproduced in the object

Viewpoint {position 0 0 15} 

EXTERNPROTO Cor1 [] "color.wrl#Yellow"

PROTO SphereCone [ field SFFloat radius 2.0 
                   field SFFloat height 5.0
                   field SFNode coneApp NULL ] 
{ Transform {
         children [
              Shape { 
                geometry Sphere {
                            radius IS radius # association
                                 }
                            appearance Appearance {
                                    material Material
                                            {diffuseColor 1 0 0}
                                                   }
                     }
              Transform {
                      translation 0 -2 0
                            children [
                                   Shape {
                                       geometry Cone {
                                             height IS height
                                                      }
                                       appearance IS coneApp
                                          } 
                                       ]
                         }
                    ]
              }
}

Group {
   children [
        DEF XSENSOR SphereSensor { autoOffset TRUE }
        DEF XFORM Transform { 
                        children SphereCone {
                           coneApp Appearance { material Cor1 {} }
                                             }
                             }
              ]
ROUTE XSENSOR.rotation_changed TO XFORM.set_rotation
}

#