#VRML V2.0 utf8 # # Tumbling Boxes # boxes.wrl # by David R. Nadeau # # This world builds a batch of perpetually tumbling boxes. # WorldInfo { title "Tumbling Boxes" info [ "Copyright (c) 1997, David R. Nadeau" ] } Viewpoint { position 0.0 0.0 10.0 description "Entry view" } NavigationInfo { type [ "EXAMINE", "ANY" ] headlight TRUE } Background { skyColor [ 0.0 0.0 0.0, 0.0 0.0 0.0, 0.0 0.8 0.2, 0.0 0.0 0.0, ] skyAngle [ 1.37 1.57, 1.77, ] } # # Since we need multiple tumbling shapes, create a generic # tumble group to automatically tumble any given group of # shapes. # PROTO TumbleGroup [ field MFNode children [ ] field SFTime xTumbleInterval 3.0 field SFTime yTumbleInterval 1.0 field SFTime zTumbleInterval 5.0 ] { DEF XRot Transform { children DEF YRot Transform { children DEF ZRot Transform { children IS children } } } DEF XClock TimeSensor { cycleInterval IS xTumbleInterval loop TRUE startTime 1.0 stopTime 0.0 } DEF YClock TimeSensor { cycleInterval IS yTumbleInterval loop TRUE startTime 1.0 stopTime 0.0 } DEF ZClock TimeSensor { cycleInterval IS zTumbleInterval loop TRUE startTime 1.0 stopTime 0.0 } DEF XRotIt OrientationInterpolator { key [ 0.0, 0.25, 0.5, 0.75, 1.0 ] keyValue [ 1.0 0.0 0.0 0.0, 1.0 0.0 0.0 1.57, 1.0 0.0 0.0 3.14, 1.0 0.0 0.0 4.71, 1.0 0.0 0.0 6.28, ] } DEF YRotIt OrientationInterpolator { key [ 0.0, 0.25, 0.5, 0.75, 1.0 ] keyValue [ 0.0 1.0 0.0 0.0, 0.0 1.0 0.0 1.57, 0.0 1.0 0.0 3.14, 0.0 1.0 0.0 4.71, 0.0 1.0 0.0 6.28, ] } DEF ZRotIt OrientationInterpolator { key [ 0.0, 0.25, 0.5, 0.75, 1.0 ] keyValue [ 0.0 0.0 1.0 0.0, 0.0 0.0 1.0 1.57, 0.0 0.0 1.0 3.14, 0.0 0.0 1.0 4.71, 0.0 0.0 1.0 6.28, ] } ROUTE XClock.fraction_changed TO XRotIt.set_fraction ROUTE YClock.fraction_changed TO YRotIt.set_fraction ROUTE ZClock.fraction_changed TO ZRotIt.set_fraction ROUTE XRotIt.value_changed TO XRot.set_rotation ROUTE YRotIt.value_changed TO YRot.set_rotation ROUTE ZRotIt.value_changed TO ZRot.set_rotation } TumbleGroup { children DEF Block Shape { appearance Appearance { material Material { } texture ImageTexture { url "brtsky.jpg" } } geometry Box { size 4.0 4.0 4.0 } } xTumbleInterval 27.0 yTumbleInterval 13.0 zTumbleInterval 45.0 } TumbleGroup { children USE Block xTumbleInterval 29.0 yTumbleInterval 31.0 zTumbleInterval 25.0 } TumbleGroup { children USE Block xTumbleInterval 38.0 yTumbleInterval 27.0 zTumbleInterval 43.0 }