#VRML V2.0 utf8
#
#
#

#
Viewpoint {
    position 0.9 1 5
}

#
Background{
    skyColor 0.2 0.2 0.7
}

SpotLight{
    color 1 1 1
}

#
#
Transform{
    translation 0 0 0
    children [
        DEF DOOR Transform{
            children[
                DEF DOORA Shape{
                    appearance Appearance{
                        material DEF setei_1 Material{
                            diffuseColor 0.7 0.7 0.7
                        }
                    }
                    geometry IndexedFaceSet{
                        coord  Coordinate{
                            point [
                                0 0 0 ,
                                1 0 0 ,
                                1 2 0 ,
                                0 2 0 ,
                            ]
                        }
                        coordIndex [
                            0 1 2 3 -1,
                        ]
                        solid FALSE
                    }
                }
            ]
        },
        
        #
        #
        #
        DEF PROX_SENSOR1 ProximitySensor{
            size 7 2 6
        }
    ]
}

#
#
Transform{
    translation 2.01 0 0
    rotation 0 1 0 3.14
        children [
            USE DOOR
    ]
}

#
#
DEF WALL Transform{
    translation -2.01 1 -0.05
    children [
        Shape{
            appearance Appearance{
                material DEF setei_2 Material{
                    diffuseColor 0.5 0.5 0.5
                }
            }
            geometry Box{ size 4 2 0.25 }
        }
    ]
}

#
#
Transform{
    translation 6.02 0 0
    rotation 5 0 0 0
    children [
        USE WALL
    ]
}

#
#
Transform{
    translation 0 -0.2 0
    children [
        Shape{
            appearance Appearance{
                material DEF setei_3 Material{
                    diffuseColor 1 1 1
                }
            }
            geometry IndexedFaceSet{
                coord DEF suichi Coordinate{
                    point [
                        2.15 1.25 0.2 ,
                        2.3 1.25 0.2 ,
                        2.3 1.4 0.2 ,
                        2.15 1.4 0.2 ,
                    ]
                }
                coordIndex [
                    0 1 2 3 -1,
                ]
                solid FALSE
            }
        },
        
        #
        DEF TS TouchSensor{}
    ]
}

#
DEF DOOR_OPEN_TIME1 TimeSensor{
     cycleInterval 8
}

#
DEF DOOR_OPEN_INTP1 PositionInterpolator{
    key[0,0.015,, 0.4, 0.65, 1]
    keyValue[0 0 0, -0.05 0 0, -1.0 0 0, -1.0 0 0, 0 0 0]
}

#
DEF ColorScript Script{
    
    #
    url "AutomaticDoor.class" 
    
    #
    eventIn SFTime touched
    
    #
    eventOut SFColor newColor
    
    #
    eventIn SFTime enterArea
    
    #
    eventOut SFTime openDoor
}

#
#
ROUTE TS.touchTime TO ColorScript.touched

#
ROUTE ColorScript.newColor TO setei_3.set_diffuseColor


#
ROUTE PROX_SENSOR1.enterTime TO ColorScript.enterArea

#
ROUTE ColorScript.openDoor TO DOOR_OPEN_TIME1.set_startTime

#
ROUTE DOOR_OPEN_TIME1.fraction_changed TO DOOR_OPEN_INTP1.set_fraction
#
ROUTE DOOR_OPEN_INTP1.value_changed TO DOOR.set_translation
