#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright [1997] By
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
	children [
		# Wall
		Transform {
			translation 70.0 -85.0 -35.0
           
			
		},
	# Left and right door panels
		Transform {
			translation 0.0 0.0 -4.95
			children [
				DEF LeftDoor Transform {
					children Transform {
						translation -0.75 0.0 0.0
						children DEF Door Inline { url "ddoornn.wrl" }
					}
				},
				DEF RightDoor Transform {
					children Transform {
						translation 0.75 0.0 0.0
						children USE Door
					}
				},
			# Visibility Sensor
				DEF DoorSense ProximitySensor {
					center 0.0 1.75 0.0
					size 70.0 98.5 98.0
				}
			]
		},
	# Sounds
		Sound {
			source DEF OpenSound AudioClip { url " " }
			minFront 20.0 minBack 20.0
			maxFront 60.0 maxBack 60.0
		},
		Sound {
			source DEF CloseSound AudioClip { url " " }
			minFront 20.0 minBack 20.0
			maxFront 60.0 maxBack 60.0
		},
	# Animation clocks
		DEF OpenClock TimeSensor {
			cycleInterval 0.5
		},
		DEF CloseClock TimeSensor {
			cycleInterval 0.5
		},
	# Animation paths for the left and right doors
		DEF LeftOpen PositionInterpolator {
			key [ 0.0, 1.0 ]
			keyValue [ 0.0 0.0 0.0, -1.3 0.0 0.0 ]
		},
		DEF LeftClose PositionInterpolator {
			key [ 0.0, 1.0 ]
			keyValue [ -1.3 0.0 0.0, 0.0 0.0 0.0 ]
		},
		DEF RightOpen PositionInterpolator {
			key [ 0.0, 1.0 ]
			keyValue [ 0.0 0.0 0.0, 1.3 0.0 0.0 ]
		},
		DEF RightClose PositionInterpolator {
			key [ 0.0, 1.0 ]
			keyValue [ 1.3 0.0 0.0, 0.0 0.0 0.0 ]
		}
	]
}
ROUTE DoorSense.enterTime         TO OpenSound.set_startTime
ROUTE DoorSense.exitTime          TO OpenSound.set_stopTime
ROUTE DoorSense.enterTime         TO OpenClock.set_startTime
ROUTE DoorSense.exitTime          TO OpenClock.set_stopTime

ROUTE DoorSense.exitTime          TO CloseSound.set_startTime
ROUTE DoorSense.enterTime         TO CloseSound.set_stopTime
ROUTE DoorSense.exitTime          TO CloseClock.set_startTime
ROUTE DoorSense.enterTime         TO CloseClock.set_stopTime

ROUTE OpenClock.fraction_changed  TO LeftOpen.set_fraction
ROUTE OpenClock.fraction_changed  TO RightOpen.set_fraction
ROUTE CloseClock.fraction_changed TO LeftClose.set_fraction
ROUTE CloseClock.fraction_changed TO RightClose.set_fraction

ROUTE LeftOpen.value_changed      TO LeftDoor.set_translation
ROUTE LeftClose.value_changed     TO LeftDoor.set_translation
ROUTE RightOpen.value_changed     TO RightDoor.set_translation
ROUTE RightClose.value_changed    TO RightDoor.set_translation
