#VRML V2.0 utf8 WorldInfo { info "Open Door, VRML 2.0 Examples by David Frerichs, frerichs@sgi.com" } Group { children [ Transform { #Fat monster geometry and translation children Group { #Fat monster geometry children Shape { appearance Appearance { material NULL texture ImageTexture { url "fatta1.gif" repeatS TRUE repeatT TRUE } textureTransform NULL } geometry IndexedFaceSet { coord Coordinate { point [ -0.5 -0.5 0, 0.5 -0.5 0, 0.5 0.5 0, -0.5 0.5 0 ] } color NULL coordIndex [ 0, 1, 2, 3, -1 ] normal NULL texCoord TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1 ] } } } } translation -0.9244 -0.159487 1.68587e-12 scale 0.570276 0.570276 0.001 } DEF Door_0 Transform { #All aspects of the door are under this #transform children [ Group { children [ DEF Time_1 TimeSensor { cycleInterval 3 startTime 0 } #The timer controls the cycle of the door. Since the timer #takes 3 seconds to cycle, the time between the time the #door rises and the time it comes back to rest is 3 sec. DEF Move_Door_2 PositionInterpolator { key [ 0, 0.1, 0.9, 1 ] keyValue [ 0 0 0, 0 1 0, 0 1 0, 0 0 0 ] #This interpolator outputs a translation from 0 to 1 and back #in the Y direction. The actual movements take only 1/10 of the #total cycle time each whlle the door spends 8/10 of its time #hanging in the up position } ] } DEF Touch_3 TouchSensor { #The touch sensor is tied to the door } Group { #Here is what the door looks like children Shape { appearance Appearance { material NULL texture ImageTexture { url "bigdoor4.jpg" repeatS TRUE repeatT TRUE } textureTransform NULL } geometry IndexedFaceSet { coord Coordinate { point [ -0.5 -0.5 0, 0.5 -0.5 0, 0.5 0.5 0, -0.5 0.5 0 ] } color NULL coordIndex [ 0, 1, 2, 3, -1 ] normal NULL texCoord TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1 ] } } } } ] translation 0 0 0 #changing this moves the door } ] } #Touching the door starts the timer ROUTE Touch_3.touchTime TO Time_1.set_startTime #Fraction output of timer sets the key of the door position interpolator ROUTE Time_1.fraction_changed TO Move_Door_2.set_fraction #Movement interpolator output changes the door's translation ROUTE Move_Door_2.value_changed TO Door_0.set_translation