#VRML V2.0 utf8 # Eric Rehmeyer # Homework 2 # Lots of stuff borrowed from VRML 2.0 Sourcebook: # http://www.wiley.com/compbooks/vrml2sbk/cover/cover.htm NavigationInfo{ headlight FALSE } Viewpoint{ description "Main view" position 6 2 -6 orientation 0 1 0 2.36 } DirectionalLight { direction 0.0 -1.0 -0.2 intensity 0.4 ambientIntensity 0.7 color 1.0 0.9 0.7 } DirectionalLight { direction 0.0 1.0 -0.2 intensity 0.4 ambientIntensity 0.7 color 1.0 0.9 0.7 } DEF TopCylinder Transform{ translation 0 4.5 0 children[ Shape { appearance Appearance { material Material { emissiveColor 0.0 0.2 0.2 } } geometry Cylinder { radius 1.5 height 0.4 } } # Sensor DEF Touch TouchSensor { }, # Animation clock speed DEF Clock TimeSensor { cycleInterval 4.0 } ] } Transform{ # Bottom cylinder translation 0 -.5 0 children[ Shape { appearance Appearance { material Material { emissiveColor 0.0 0.2 0.2 } } geometry Cylinder { radius 1.5 height 0.4 } } ] } Shape{ # Line for Sphere1 to follow... appearance Appearance{ material Material{ diffuseColor 0.3 0.5 0.5 } } geometry Extrusion{ creaseAngle 1.57 crossSection[ .06 0, .042 -.042, 0 -.06, -.042 -.042, -.06 0, -.042 .042, 0 .06, .042 .042, .06 0 ] spine[ .309, 4.6, -.951 0, 4.5, -1 -.309, 4.4, -.951 -.588, 4.3, -.809 -.809, 4.2, -.588 -.951, 4.1, -.309 -1, 4.0, 0 -.951, 3.9, .309 -.809, 3.8, .588 -.588, 3.7, .809 -.309, 3.6, .951 0, 3.5, 1 .309, 3.4, .951 .588, 3.3, .809 .809, 3.2, .588 .951, 3.1, .309 1, 3.0, 0 .951, 2.9, -.309 .809, 2.8, -.588 .588, 2.7, -.809 .309, 2.6, -.951 0, 2.5, -1 -.309, 2.4, -.951 -.588, 2.3, -.809 -.809, 2.2, -.588 -.951, 2.1, -.309 -1, 2.0, 0 -.951, 1.9, .309 -.809, 1.8, .588 -.588, 1.7, .809 -.309, 1.6, .951 0, 1.5, 1 .309, 1.4, .951 .588, 1.3, .809 .809, 1.2, .588 .951, 1.1, .309 1, 1.0, 0 .951, 0.9, -.309 .809, 0.8, -.588 .588, 0.7, -.809 .309, 0.6, -.951 0, 0.5, -1 -.309, 0.4, -.951 -.588, 0.3, -.809 -.809, 0.2, -.588 -.951, 0.1, -.309 -1, 0.0, 0 -.951, -0.1, .309 -.809, -0.2, .588 -.588, -0.3, .809 -.309, -0.4, .951 0, -0.5, 1 .309, -0.6, .951 ] } } Group { children [ # Moving Sphere1 DEF Sphere1 Transform { translation -1 4 0 children [ Sound{ source DEF Sound1 AudioClip{ url "electric.wav" loop FALSE } intensity 1 }, Shape { appearance Appearance { material Material { diffuseColor 0.2 0.2 1 } } geometry Sphere { radius 0.3 } } ] }, # Animation path DEF SpherePath1 PositionInterpolator { key [ 0.0, 0.025, 0.05, 0.075 0.1, 0.125, 0.15, 0.175 0.2, 0.225, 0.25, 0.275 0.3, 0.325, 0.35, 0.375 0.4, 0.425, 0.45, 0.475 0.5, 0.525, 0.55, 0.575 0.6, 0.625, 0.65, 0.675 0.7, 0.725, 0.75, 0.775 0.8, 0.825, 0.85, 0.875 0.9, 0.925, 0.95, 0.975 1 ] keyValue [ -1, 4.0, 0 -.951, 3.9, .309 -.809, 3.8, .588 -.588, 3.7, .809 -.309, 3.6, .951 0, 3.5, 1 .309, 3.4, .951 .588, 3.3, .809 .809, 3.2, .588 .951, 3.1, .309 1, 3.0, 0 .951, 2.9, -.309 .809, 2.8, -.588 .588, 2.7, -.809 .309, 2.6, -.951 0, 2.5, -1 -.309, 2.4, -.951 -.588, 2.3, -.809 -.809, 2.2, -.588 -.951, 2.1, -.309 -1, 2.0, 0 -.951, 1.9, .309 -.809, 1.8, .588 -.588, 1.7, .809 -.309, 1.6, .951 0, 1.5, 1 .309, 1.4, .951 .588, 1.3, .809 .809, 1.2, .588 .951, 1.1, .309 1, 1.0, 0 .951, 0.9, -.309 .809, 0.8, -.588 .588, 0.7, -.809 .309, 0.6, -.951 0, 0.5, -1 -.309, 0.4, -.951 -.588, 0.3, -.809 -.809, 0.2, -.588 -.951, 0.1, -.309 -1, 0.0, 0 ] } ] } Shape{ # Line for Sphere2 to follow... appearance Appearance{ material Material{ diffuseColor 0.3 0.5 0.5 } } geometry Extrusion{ creaseAngle 1.57 crossSection[ .06 0, .042 -.042, 0 -.06, -.042 -.042, -.06 0, -.042 .042, 0 .06, .042 .042, .06 0 ] spine[ -.309, 4.6, -.951 0, 4.5, -1 .309, 4.4, -.951 .588, 4.3, -.809 .809, 4.2, -.588 .951, 4.1, -.309 1, 4.0, 0 .951, 3.9, .309 .809, 3.8, .588 .588, 3.7, .809 .309, 3.6, .951 0, 3.5, 1 -.309, 3.4, .951 -.588, 3.3, .809 -.809, 3.2, .588 -.951, 3.1, .309 -1, 3.0, 0 -.951, 2.9, -.309 -.809, 2.8, -.588 -.588, 2.7, -.809 -.309, 2.6, -.951 0, 2.5, -1 .309, 2.4, -.951 .588, 2.3, -.809 .809, 2.2, -.588 .951, 2.1, -.309 1, 2.0, 0 .951, 1.9, .309 .809, 1.8, .588 .588, 1.7, .809 .309, 1.6, .951 0, 1.5, 1 -.309, 1.4, .951 -.588, 1.3, .809 -.809, 1.2, .588 -.951, 1.1, .309 -1, 1.0, 0 -.951, 0.9, -.309 -.809, 0.8, -.588 -.588, 0.7, -.809 -.309, 0.6, -.951 0, 0.5, -1 .309, 0.4, -.951 .588, 0.3, -.809 .809, 0.2, -.588 .951, 0.1, -.309 1, 0.0, 0 .951, -0.1, .309 .809, -0.2, .588 .588, -0.3, .809 .309, -0.4, .951 0, -0.5, 1 -.309, -0.6, .951 ] } } Group { children [ # Moving Sphere2 DEF Sphere2 Transform { translation 1 4 0 children [ Sound{ source DEF Sound2 AudioClip{ url "listen.wav" loop FALSE } intensity 1 }, Shape { appearance Appearance { material Material { diffuseColor 0.2 0.9 0.4 } } geometry Sphere { radius 0.3 } } ] }, # Animation path DEF SpherePath2 PositionInterpolator { key [ 0.0, 0.025, 0.05, 0.075 0.1, 0.125, 0.15, 0.175 0.2, 0.225, 0.25, 0.275 0.3, 0.325, 0.35, 0.375 0.4, 0.425, 0.45, 0.475 0.5, 0.525, 0.55, 0.575 0.6, 0.625, 0.65, 0.675 0.7, 0.725, 0.75, 0.775 0.8, 0.825, 0.85, 0.875 0.9, 0.925, 0.95, 0.975 1 ] keyValue [ # cos (index*18), sin (index*18), index 1, 4.0, 0 .951, 3.9, .309 .809, 3.8, .588 .588, 3.7, .809 .309, 3.6, .951 0, 3.5, 1 -.309, 3.4, .951 -.588, 3.3, .809 -.809, 3.2, .588 -.951, 3.1, .309 -1, 3.0, 0 -.951, 2.9, -.309 -.809, 2.8, -.588 -.588, 2.7, -.809 -.309, 2.6, -.951 0, 2.5, -1 .309, 2.4, -.951 .588, 2.3, -.809 .809, 2.2, -.588 .951, 2.1, -.309 1, 2.0, 0 .951, 1.9, .309 .809, 1.8, .588 .588, 1.7, .809 .309, 1.6, .951 0, 1.5, 1 -.309, 1.4, .951 -.588, 1.3, .809 -.809, 1.2, .588 -.951, 1.1, .309 -1, 1.0, 0 -.951, 0.9, -.309 -.809, 0.8, -.588 -.588, 0.7, -.809 -.309, 0.6, -.951 0, 0.5, -1 .309, 0.4, -.951 .588, 0.3, -.809 .809, 0.2, -.588 .951, 0.1, -.309 1, 0.0, 0 ] } ] } Transform{ translation 0 2 0 children[Shape{ # Line for Sphere3 to follow... appearance Appearance{ material Material{ diffuseColor 0.3 0.5 0.5 } } geometry Cylinder{ radius 0.06 height 5.2 } }] } Group { children [ # Moving Sphere3 DEF Sphere3 Transform { translation 0 4 0 children [ Sound{ source DEF Sound3 AudioClip{ url "donkey.wav" loop FALSE } intensity 1 }, PointLight{ location 0.0 0.0 0.0 radius 1.5 intensity 1.0 ambientIntensity 0.8 color 1 1 1 }, Shape { appearance Appearance { material Material { emissiveColor 0.2 1 0.9 } } geometry Sphere { radius 0.3 } } ] }, # Animation path DEF SpherePath3 PositionInterpolator { key [ 0.0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.675, 0.7, 0.725, 0.75, 0.775, 0.8, 0.825, 0.85, 0.875, 0.9, 0.925, 0.95, 0.975, 1 ] keyValue [ 0, 4.0, 0 0, 3.9, 0 0, 3.8, 0 0, 3.7, 0 0, 3.6, 0 0, 3.5, 0 0, 3.4, 0 0, 3.3, 0 0, 3.2, 0 0, 3.1, 0 0, 3.0, 0 0, 2.9, 0 0, 2.8, 0 0, 2.7, 0 0, 2.6, 0 0, 2.5, 0 0, 2.4, 0 0, 2.3, 0 0, 2.2, 0 0, 2.1, 0 0, 2.0, 0 0, 1.9, 0 0, 1.8, 0 0, 1.7, 0 0, 1.6, 0 0, 1.5, 0 0, 1.4, 0 0, 1.3, 0 0, 1.2, 0 0, 1.1, 0 0, 1.0, 0 0, 0.9, 0 0, 0.8, 0 0, 0.7, 0 0, 0.6, 0 0, 0.5, 0 0, 0.4, 0 0, 0.3, 0 0, 0.2, 0 0, 0.1, 0 0, 0.0, 0 ] } ] } ROUTE Touch.touchTime TO Clock.set_startTime ROUTE Clock.fraction_changed TO SpherePath1.set_fraction ROUTE SpherePath1.value_changed TO Sphere1.set_translation ROUTE Clock.fraction_changed TO SpherePath2.set_fraction ROUTE SpherePath2.value_changed TO Sphere2.set_translation ROUTE Clock.fraction_changed TO SpherePath3.set_fraction ROUTE SpherePath3.value_changed TO Sphere3.set_translation ROUTE Touch.touchTime TO Sound1.set_startTime ROUTE Touch.touchTime TO Sound2.set_startTime ROUTE Touch.touchTime TO Sound3.set_startTime