media @ VU
[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources _

talk show tell print

web3d-example-board.vr

web3d-example-board.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

Web3D/VR

snowboard


  
  PROTO Snowboard [
      exposedField MFString topTexture []
      exposedField SFNode topMaterial Material {
                diffuseColor 0.2 0.5529 0.1765
                ambientIntensity 0.1033
                specularColor 0.045 0.045 0.045
                shininess 0.2875
                transparency 0
              }
      exposedField MFString baseTexture []
      exposedField SFNode baseMaterial Material {
                diffuseColor 0.1961 0.1961 0.1961
                ambientIntensity 0.1033
                specularColor 0.045 0.045 0.045
                shininess 0.2875
                transparency 0
              }
  ] {
      Transform {
    scale 0.01 0.01 0.01
    translation -0.01 0.03 0
    children [
      Transform {
        translation -0.02787 -2.517 0.6719
        children [
          Shape {
            appearance Appearance {
              material IS topMaterial
              texture ImageTexture {
                url IS topTexture
              }
            }
            geometry IndexedFaceSet {
              ccw TRUE
              solid TRUE
              coord Coordinate { point [
                -18.51 -0.6335 70.7, -12.62 1.86 75.36, -4.095 2.693 76.92, 
                4.396 2.627 76.8, 12.71 2.048 75.71, 18.64 -0.5363 70.88, 
                -19.99 -1.069 63.98, 20.01 -1.069 63.98, -19.98 -0.5668 45.3, 
                20.02 -0.5668 45.3, -18.18 -0.03593 11.41, 18.21 -0.03582 11.39, 
                -18.18 -0.03615 -11.45, 18.21 -0.03636 -11.47, 
                -19.96 -0.5647 -45.21, 20.04 -0.5647 -45.21, -19.99 -1.102 -65.23, 
                20.01 -1.102 -65.23, -17.03 0.2689 -72.24, -11.71 2.692 -76.77, 
                -4.535 3.488 -78.27, 4.743 3.488 -78.27, 11.75 2.604 -76.61, 
                17.91 -0.0829 -71.58, -18.51 2.009 69.28, -12.62 4.507 73.95, 
                -4.095 5.341 75.52, 4.396 5.275 75.39, 12.71 4.695 74.3, 
                18.64 2.107 69.47, -19.99 1.835 63.23, -11.99 1.835 63.23, 
                20.01 1.835 63.23, -19.98 2.432 45.37, 20.02 2.432 45.37, 
                -18.18 2.964 11.43, 18.21 2.964 11.41, -18.18 2.964 -11.47, 
                18.21 2.964 -11.48, -19.96 2.434 -45.29, 20.04 2.434 -45.29, 
                -19.99 1.782 -64.41, 12.01 1.782 -64.41, 20.01 1.782 -64.41, 
                -17.03 2.913 -70.82, -11.71 5.34 -75.36, -4.535 6.137 -76.86, 
                4.743 6.137 -76.86, 11.75 5.252 -75.2, 17.91 2.561 -70.16]
              }
              texCoord TextureCoordinate { point [
                0.03643 0.0539, 0.1839 0.02479, 0.3969 0.01502, 0.6092 0.01579, 
                0.8169 0.02258, 0.9653 0.05277, -0.0003901 0.09593, 
                0.1996 0.09593, 0.9996 0.09593, -0.0001255 0.2127, 
                0.9999 0.2127, 0.0449 0.4245, 0.9545 0.4246, 0.0449 0.5673, 
                0.9545 0.5675, 0.0004151 0.7784, 1 0.7784, -0.0004151 0.9035, 
                0.7996 0.9035, 0.9996 0.9035, 0.07359 0.9473, 0.2065 0.9756, 
                0.3859 0.985, 0.6179 0.985, 0.793 0.9746, 0.947 0.9432, 
                0.03643 0.06277, 0.1839 0.03361, 0.3969 0.02383, 
                0.6092 0.0246, 0.8169 0.0314, 0.9653 0.06164, -0.0003901 0.1006, 
                0.1996 0.1006, 0.9996 0.1006, -0.0001255 0.2122, 
                0.9999 0.2122, 0.0449 0.4244, 0.9545 0.4245, 0.0449 0.5675, 
                0.9545 0.5676, 0.0004151 0.7789, 1 0.7789, -0.0004151 0.8983, 
                0.7996 0.8983, 0.9996 0.8983, 0.07359 0.9384, 0.2065 0.9668, 
                0.3859 0.9762, 0.6179 0.9762, 0.793 0.9658, 0.947 0.9343]
              }
              coordIndex [
                24, 25, 31, -1, 31, 30, 24, -1, 25, 26, 31, -1, 26, 27, 31, -1, 
                27, 28, 31, -1, 28, 29, 32, -1, 32, 31, 28, -1, 
                30, 31, 33, -1, 31, 32, 34, -1, 31, 34, 36, -1, 
                36, 33, 31, -1, 35, 33, 38, -1, 38, 37, 35, -1, 
                33, 36, 38, -1, 40, 37, 38, -1, 39, 37, 42, -1, 
                42, 41, 39, -1, 37, 40, 42, -1, 43, 42, 40, -1, 
                45, 44, 41, -1, 41, 42, 46, -1, 46, 45, 41, -1, 
                47, 46, 42, -1, 48, 47, 42, -1, 42, 43, 49, -1, 
                49, 48, 42, -1, 0, 1, 25, -1, 25, 24, 0, -1, 1, 2, 26, -1, 
                26, 25, 1, -1, 2, 3, 27, -1, 27, 26, 2, -1, 3, 4, 28, -1, 
                28, 27, 3, -1, 4, 5, 29, -1, 29, 28, 4, -1, 5, 7, 32, -1, 
                32, 29, 5, -1, 7, 9, 34, -1, 34, 32, 7, -1, 9, 11, 36, -1, 
                36, 34, 9, -1, 11, 13, 38, -1, 38, 36, 11, -1, 
                13, 15, 40, -1, 40, 38, 13, -1, 15, 17, 43, -1, 
                43, 40, 15, -1, 17, 23, 49, -1, 49, 43, 17, -1, 
                23, 22, 48, -1, 48, 49, 23, -1, 22, 21, 47, -1, 
                47, 48, 22, -1, 21, 20, 46, -1, 46, 47, 21, -1, 
                20, 19, 45, -1, 45, 46, 20, -1, 19, 18, 44, -1, 
                44, 45, 19, -1, 18, 16, 41, -1, 41, 44, 18, -1, 
                16, 14, 39, -1, 39, 41, 16, -1, 14, 12, 37, -1, 
                37, 39, 14, -1, 12, 10, 35, -1, 35, 37, 12, -1, 
                10, 8, 33, -1, 33, 35, 10, -1, 8, 6, 30, -1, 30, 33, 8, -1, 
                6, 0, 24, -1, 24, 30, 6, -1]
              texCoordIndex [
                26, 27, 33, -1, 33, 32, 26, -1, 27, 28, 33, -1, 28, 29, 33, -1, 
                29, 30, 33, -1, 30, 31, 34, -1, 34, 33, 30, -1, 
                32, 33, 35, -1, 33, 34, 36, -1, 33, 36, 38, -1, 
                38, 35, 33, -1, 37, 35, 40, -1, 40, 39, 37, -1, 
                35, 38, 40, -1, 42, 39, 40, -1, 41, 39, 44, -1, 
                44, 43, 41, -1, 39, 42, 44, -1, 45, 44, 42, -1, 
                47, 46, 43, -1, 43, 44, 48, -1, 48, 47, 43, -1, 
                49, 48, 44, -1, 50, 49, 44, -1, 44, 45, 51, -1, 
                51, 50, 44, -1, 0, 1, 27, -1, 27, 26, 0, -1, 1, 2, 28, -1, 
                28, 27, 1, -1, 2, 3, 29, -1, 29, 28, 2, -1, 3, 4, 30, -1, 
                30, 29, 3, -1, 4, 5, 31, -1, 31, 30, 4, -1, 5, 8, 34, -1, 
                34, 31, 5, -1, 8, 10, 36, -1, 36, 34, 8, -1, 10, 12, 38, -1, 
                38, 36, 10, -1, 12, 14, 40, -1, 40, 38, 12, -1, 
                14, 16, 42, -1, 42, 40, 14, -1, 16, 19, 45, -1, 
                45, 42, 16, -1, 19, 25, 51, -1, 51, 45, 19, -1, 
                25, 24, 50, -1, 50, 51, 25, -1, 24, 23, 49, -1, 
                49, 50, 24, -1, 23, 22, 48, -1, 48, 49, 23, -1, 
                22, 21, 47, -1, 47, 48, 22, -1, 21, 20, 46, -1, 
                46, 47, 21, -1, 20, 17, 43, -1, 43, 46, 20, -1, 
                17, 15, 41, -1, 41, 43, 17, -1, 15, 13, 39, -1, 
                39, 41, 15, -1, 13, 11, 37, -1, 37, 39, 13, -1, 
                11, 9, 35, -1, 35, 37, 11, -1, 9, 6, 32, -1, 32, 35, 9, -1, 
                6, 0, 26, -1, 26, 32, 6, -1]
              }
          }
        ]
      },
      Transform {
        translation -0.02787 -2.517 0.6719
        children [
          Shape {
            appearance Appearance {
              material IS baseMaterial
              textureTransform TextureTransform { scale -1 1 }
              texture ImageTexture {
                url IS baseTexture
              }
            }
            geometry IndexedFaceSet {
              ccw TRUE
              solid TRUE
              coord Coordinate { point [
                -18.51 -0.6335 70.7, -12.62 1.86 75.36, -4.095 2.693 76.92, 
                4.396 2.627 76.8, 12.71 2.048 75.71, 18.64 -0.5363 70.88, 
                -19.99 -1.069 63.98, -11.99 -1.069 63.98, 20.01 -1.069 63.98, 
                -19.98 -0.5668 45.3, 20.02 -0.5668 45.3, -18.18 -0.03593 11.41, 
                18.21 -0.03582 11.39, -18.18 -0.03615 -11.45, 18.21 -0.03636 -11.47, 
                -19.96 -0.5647 -45.21, 20.04 -0.5647 -45.21, -19.99 -1.102 -65.23, 
                12.01 -1.102 -65.23, 20.01 -1.102 -65.23, -17.03 0.2689 -72.24, 
                -11.71 2.692 -76.77, -4.535 3.488 -78.27, 4.743 3.488 -78.27, 
                11.75 2.604 -76.61, 17.91 -0.0829 -71.58]
              }
              texCoord TextureCoordinate { point [
                0.03643 0.0539, 0.1839 0.02479, 0.3969 0.01502, 0.6092 0.01579, 
                0.8169 0.02258, 0.9653 0.05277, -0.0003901 0.09593, 
                0.1996 0.09593, 0.9996 0.09593, -0.0001255 0.2127, 
                0.9999 0.2127, 0.0449 0.4245, 0.9545 0.4246, 0.0449 0.5673, 
                0.9545 0.5675, 0.0004151 0.7784, 1 0.7784, -0.0004151 0.9035, 
                0.7996 0.9035, 0.9996 0.9035, 0.07359 0.9473, 0.2065 0.9756, 
                0.3859 0.985, 0.6179 0.985, 0.793 0.9746, 0.947 0.9432, 
                0.03643 0.06277, 0.1839 0.03361, 0.3969 0.02383, 
                0.6092 0.0246, 0.8169 0.0314, 0.9653 0.06164, -0.0003901 0.1006, 
                0.1996 0.1006, 0.9996 0.1006, -0.0001255 0.2122, 
                0.9999 0.2122, 0.0449 0.4244, 0.9545 0.4245, 0.0449 0.5675, 
                0.9545 0.5676, 0.0004151 0.7789, 1 0.7789, -0.0004151 0.8983, 
                0.7996 0.8983, 0.9996 0.8983, 0.07359 0.9384, 0.2065 0.9668, 
                0.3859 0.9762, 0.6179 0.9762, 0.793 0.9658, 0.947 0.9343]
              }
              coordIndex [
                0, 6, 7, -1, 7, 1, 0, -1, 7, 2, 1, -1, 7, 3, 2, -1, 
                7, 4, 3, -1, 4, 7, 8, -1, 8, 5, 4, -1, 9, 7, 6, -1, 
                7, 9, 10, -1, 10, 8, 7, -1, 9, 11, 12, -1, 12, 10, 9, -1, 
                13, 12, 11, -1, 12, 13, 14, -1, 13, 15, 16, -1, 
                16, 14, 13, -1, 15, 17, 18, -1, 18, 16, 15, -1, 
                16, 18, 19, -1, 17, 20, 21, -1, 17, 21, 22, -1, 
                17, 22, 23, -1, 17, 23, 24, -1, 24, 18, 17, -1, 
                18, 24, 25, -1, 25, 19, 18, -1]
              texCoordIndex [
                0, 6, 7, -1, 7, 1, 0, -1, 7, 2, 1, -1, 7, 3, 2, -1, 
                7, 4, 3, -1, 4, 7, 8, -1, 8, 5, 4, -1, 9, 7, 6, -1, 
                7, 9, 10, -1, 10, 8, 7, -1, 9, 11, 12, -1, 12, 10, 9, -1, 
                13, 12, 11, -1, 12, 13, 14, -1, 13, 15, 16, -1, 
                16, 14, 13, -1, 15, 17, 18, -1, 18, 16, 15, -1, 
                16, 18, 19, -1, 17, 20, 21, -1, 17, 21, 22, -1, 
                17, 22, 23, -1, 17, 23, 24, -1, 24, 18, 17, -1, 
                18, 24, 25, -1, 25, 19, 18, -1]
              }
          }
        ]
      }
    ]
  }
  }
  
  

boot


  
  PROTO Boot [
      exposedField MFString textureUrl []
      exposedField SFNode material Material {
            diffuseColor 0.7176 0.7176 0.7176
            ambientIntensity 0.1804
            specularColor 0.045 0.045 0.045
            shininess 0.2875
            transparency 0
          }
  ] {
  Transform {
  
    translation 0.05 0.1 0.01
    rotation 0.5774 -0.5774 0.5774 -4.189
    scale 0.001 0.001 0.001
    children [
      Shape {
        appearance Appearance {
               material IS material
          texture ImageTexture {
              url IS textureUrl
          }
        }
        geometry IndexedFaceSet {
          ccw TRUE
          solid TRUE
          coord Coordinate { point [
            -23.61 4 75.32, 42.53 4 73.66, 103.3 4 65.78, 103.4 4 -44.46, 
            70.13 4 -118.8, 31.15 2 -100.5, -8.55 4 -102.1, -26.73 4 -79.48, 
            -28.58 4 -50.53, 2.971 2.4 -26.57, -33.44 4 -12.03, 
            -159 4 41.4, -23.61 96 75.32, -13.02 97.6 57.05, 70.13 96 -118.8, 
            -2.93 96 -103.6, -22.62 96 -78.46, -24.47 96 -49.51, 
            -26.91 97 -10.74, -34.58 96 -14.29, -142.1 3.083 68.98, 
            -5.007 3 59.03, 139 20 35.47, 81.77 3 -36.63, 48.64 3 -116, 
            -14.23 10.33 -108.9, -7.985 3.083 -90.55, -26.02 3.083 -47.89, 
            -31.81 20 -40.89, -10.36 2.95 -43.23, -23.45 10.2 -32.16, 
            -27.41 20 -36.48, -28.31 3.083 -8.643, -48.9 3 19.72, 
            -133 3.083 35.99, -177.4 20 35.3, -192.9 20 44.39, 
            -162.7 3.167 52.94, -197.6 20 53.61, 119.8 30 -61.91, 
            122.9 50 -61.91, 119.8 70 -61.91, 111 80 -86.88, -27.41 80 -36.48, 
            -30.8 80 -27.5, -38.1 80 -21.09, -142.1 96.92 68.98, 
            87.56 96.92 -61.33, 76.8 89.67 -119.7, 48.62 96.97 -116.4, 
            -13.67 89.67 -109.1, 12.75 96.97 -101.3, 1.737 96.92 -92.97, 
            -30.77 89.67 -48.2, -23.76 89.8 -31.3, -1.577 97.05 -32.54, 
            -48.99 97 19.55, -95.99 96.92 30.17, -150.2 96.83 39.81, 
            -162.7 96.83 52.94, -176.8 10.25 63.75, -86.72 10.25 82.11, 
            -31.93 10.25 81.49, -15.54 10.25 76.76, 107.7 10.25 73.9, 
            122.4 10.25 66.49, 113.1 10.25 -37.96, 108.2 10.25 -56.81, 
            101.7 10.25 -86.88, 90.91 10.25 -110.6, 47.81 10.25 -119.1, 
            -25.47 10.25 -88.71, -29.26 10.25 -41.51, -24.23 10.25 -37.14, 
            -34.84 10.25 -20.04, -58.39 10.25 8.107, -201.1 30 64.07, 
            140.4 30 67.22, 129.9 30 -46.65, 103.9 30 -110.5, -35.16 30 -65, 
            -185.5 30 35.3, -201.8 30 44.39, -206.7 30 53.61, -206.3 50 64.07, 
            133.2 50 -46.65, 119.1 50 -86.88, 106.6 50 -110.5, 
            -49.48 50 -11.73, -207 50 44.39, -212 50 53.61, -201.1 70 64.07, 
            -172.8 70 76.39, 123.2 70 74.82, 140.4 70 67.22, 145.4 70 35.47, 
            103.9 70 -110.5, -28.87 70 -89.33, -28.68 70 -36.48, 
            -32.22 70 -27.5, -185.5 70 35.3, -206.7 70 53.61, -86.72 89.75 82.11, 
            -31.93 89.75 81.49, -15.54 89.75 76.76, 67.23 89.75 79.23, 
            122.7 89.75 66.66, 90.91 89.75 -110.6, 47.81 89.75 -119.1, 
            -2.644 89.75 -111.9, -24.86 89.75 -88.56, -28.64 89.75 -41.35, 
            -23.4 89.75 -36.21, -28.06 89.75 -26.23, -35.01 89.75 -20.38, 
            -42.24 89.75 -11.25, -80.96 89.75 18.65, -139.3 89.75 30.29, 
            -23.58 0.75 -64.96, 52.62 99.29 -72.05]
          }
          texCoord TextureCoordinate { point [
            0.5189 0.1754, 0.6781 0.1811, 0.8243 0.2085, 0.8247 0.5906, 
            0.7445 0.8481, 0.6507 0.7847, 0.5551 0.7903, 0.5114 0.712, 
            0.5069 0.6116, 0.5829 0.5286, 0.4952 0.4782, 0.1931 0.293, 
            0.5189 0.1754, 0.5444 0.2387, 0.7445 0.8481, 0.5687 0.7955, 
            0.5213 0.7085, 0.5168 0.6081, 0.5109 0.4737, 0.4925 0.486, 
            0.2338 0.1974, 0.5637 0.2319, 0.9102 0.3135, 0.7725 0.5634, 
            0.6928 0.8387, 0.5415 0.814, 0.5565 0.7504, 0.5131 0.6025, 
            0.4992 0.5782, 0.5508 0.5863, 0.5193 0.548, 0.5097 0.5629, 
            0.5076 0.4664, 0.458 0.3681, 0.2555 0.3117, 0.1488 0.3141, 
            0.1114 0.2826, 0.1841 0.253, 0.1001 0.2507, 0.8641 0.6511, 
            0.8715 0.6511, 0.8641 0.6511, 0.8428 0.7377, 0.5097 0.5629, 
            0.5016 0.5318, 0.484 0.5096, 0.2338 0.1974, 0.7865 0.6491, 
            0.7605 0.8513, 0.6927 0.8401, 0.5428 0.8145, 0.6064 0.7876, 
            0.5799 0.7588, 0.5017 0.6036, 0.5185 0.545, 0.5719 0.5493, 
            0.4578 0.3687, 0.3447 0.3319, 0.2143 0.2985, 0.1841 0.253, 
            0.1503 0.2155, 0.367 0.1519, 0.4989 0.154, 0.5383 0.1704, 
            0.8349 0.1803, 0.8704 0.206, 0.8478 0.5681, 0.8361 0.6334, 
            0.8206 0.7377, 0.7945 0.8197, 0.6908 0.8494, 0.5144 0.744, 
            0.5053 0.5804, 0.5174 0.5652, 0.4919 0.506, 0.4352 0.4084, 
            0.09168 0.2144, 0.9136 0.2035, 0.8884 0.5982, 0.8258 0.8197, 
            0.4911 0.6618, 0.1292 0.3141, 0.09004 0.2826, 0.07823 0.2507, 
            0.07926 0.2144, 0.8964 0.5982, 0.8623 0.7377, 0.8322 0.8197, 
            0.4566 0.4771, 0.07757 0.2826, 0.06545 0.2507, 0.09168 0.2144, 
            0.1598 0.1717, 0.8723 0.1771, 0.9136 0.2035, 0.9256 0.3135, 
            0.8258 0.8197, 0.5062 0.7461, 0.5067 0.5629, 0.4982 0.5318, 
            0.1292 0.3141, 0.07823 0.2507, 0.367 0.1519, 0.4989 0.154, 
            0.5383 0.1704, 0.7375 0.1618, 0.871 0.2054, 0.7945 0.8197, 
            0.6908 0.8494, 0.5694 0.8243, 0.5159 0.7435, 0.5068 0.5798, 
            0.5194 0.562, 0.5082 0.5274, 0.4914 0.5071, 0.4741 0.4755, 
            0.3809 0.3718, 0.2405 0.3315, 0.519 0.6617, 0.7024 0.6862]
          }
          coordIndex [
            20, 60, 37, -1, 62, 61, 0, -1, 61, 20, 0, -1, 63, 62, 0, -1, 
            63, 0, 21, -1, 0, 20, 21, -1, 20, 33, 21, -1, 63, 21, 1, -1, 
            21, 33, 1, -1, 65, 64, 2, -1, 64, 1, 2, -1, 22, 65, 2, -1, 
            66, 22, 2, -1, 1, 23, 2, -1, 66, 2, 23, -1, 66, 23, 3, -1, 
            67, 66, 3, -1, 23, 24, 3, -1, 68, 67, 3, -1, 24, 68, 3, -1, 
            69, 68, 4, -1, 68, 24, 4, -1, 24, 70, 4, -1, 25, 70, 5, -1, 
            70, 24, 5, -1, 24, 23, 5, -1, 23, 26, 5, -1, 26, 71, 6, -1, 
            71, 25, 6, -1, 25, 5, 6, -1, 5, 26, 6, -1, 7, 71, 26, -1, 
            118, 7, 26, -1, 27, 72, 8, -1, 72, 80, 8, -1, 80, 7, 8, -1, 
            7, 118, 8, -1, 118, 27, 8, -1, 73, 72, 29, -1, 72, 27, 29, -1, 
            27, 118, 29, -1, 118, 26, 29, -1, 23, 1, 9, -1, 30, 73, 9, -1, 
            73, 29, 9, -1, 29, 26, 9, -1, 26, 23, 9, -1, 74, 30, 32, -1, 
            30, 9, 32, -1, 9, 1, 32, -1, 1, 33, 32, -1, 75, 74, 10, -1, 
            74, 32, 10, -1, 32, 33, 10, -1, 75, 10, 33, -1, 20, 34, 33, -1, 
            34, 75, 33, -1, 20, 37, 34, -1, 35, 34, 11, -1, 34, 37, 11, -1, 
            37, 60, 38, -1, 60, 76, 38, -1, 76, 83, 38, -1, 20, 92, 60, -1, 
            92, 76, 60, -1, 20, 61, 92, -1, 64, 93, 1, -1, 93, 64, 77, -1, 
            64, 65, 77, -1, 65, 22, 77, -1, 22, 66, 78, -1, 66, 67, 78, -1, 
            39, 78, 67, -1, 68, 39, 67, -1, 86, 39, 68, -1, 69, 79, 68, -1, 
            79, 86, 68, -1, 69, 4, 79, -1, 4, 70, 79, -1, 7, 80, 71, -1, 
            80, 72, 28, -1, 72, 73, 28, -1, 73, 31, 28, -1, 73, 30, 31, -1, 
            30, 74, 31, -1, 11, 36, 35, -1, 36, 82, 35, -1, 82, 81, 35, -1, 
            11, 37, 36, -1, 37, 38, 36, -1, 38, 83, 36, -1, 83, 82, 36, -1, 
            76, 84, 83, -1, 84, 90, 83, -1, 76, 92, 84, -1, 77, 94, 93, -1, 
            95, 94, 77, -1, 77, 22, 95, -1, 22, 78, 95, -1, 78, 85, 95, -1, 
            40, 85, 78, -1, 78, 39, 40, -1, 39, 86, 40, -1, 79, 87, 86, -1, 
            80, 28, 98, -1, 31, 98, 28, -1, 74, 98, 31, -1, 74, 75, 88, -1, 
            75, 116, 88, -1, 75, 34, 116, -1, 34, 35, 116, -1, 
            81, 82, 89, -1, 83, 90, 82, -1, 90, 89, 82, -1, 84, 91, 90, -1, 
            91, 101, 90, -1, 84, 92, 91, -1, 41, 95, 85, -1, 40, 41, 85, -1, 
            40, 86, 41, -1, 87, 96, 86, -1, 79, 70, 87, -1, 25, 71, 97, -1, 
            71, 80, 97, -1, 80, 53, 97, -1, 80, 98, 53, -1, 74, 99, 98, -1, 
            74, 88, 99, -1, 35, 117, 116, -1, 35, 81, 117, -1, 
            81, 100, 117, -1, 81, 89, 100, -1, 89, 101, 100, -1, 
            90, 101, 89, -1, 91, 59, 101, -1, 92, 46, 91, -1, 92, 61, 46, -1, 
            61, 102, 46, -1, 61, 62, 102, -1, 62, 103, 102, -1, 
            62, 63, 103, -1, 63, 104, 103, -1, 63, 105, 104, -1, 
            63, 1, 105, -1, 1, 93, 105, -1, 93, 106, 105, -1, 93, 94, 106, -1, 
            94, 95, 106, -1, 47, 106, 95, -1, 41, 47, 95, -1, 42, 47, 41, -1, 
            41, 86, 42, -1, 86, 96, 42, -1, 96, 107, 42, -1, 107, 96, 48, -1, 
            96, 87, 48, -1, 87, 70, 48, -1, 70, 108, 48, -1, 70, 25, 108, -1, 
            25, 109, 108, -1, 109, 25, 50, -1, 25, 97, 50, -1, 
            97, 110, 50, -1, 97, 53, 110, -1, 53, 16, 110, -1, 
            98, 111, 53, -1, 98, 43, 111, -1, 43, 112, 111, -1, 
            54, 112, 43, -1, 98, 99, 43, -1, 99, 44, 43, -1, 44, 113, 43, -1, 
            113, 54, 43, -1, 99, 45, 44, -1, 45, 114, 44, -1, 114, 113, 44, -1, 
            99, 88, 45, -1, 88, 115, 45, -1, 115, 114, 45, -1, 
            88, 116, 115, -1, 101, 59, 100, -1, 91, 46, 59, -1, 
            102, 12, 46, -1, 12, 57, 46, -1, 57, 59, 46, -1, 102, 103, 12, -1, 
            103, 104, 12, -1, 18, 12, 13, -1, 12, 104, 13, -1, 
            104, 105, 13, -1, 55, 13, 105, -1, 55, 105, 106, -1, 
            47, 55, 106, -1, 42, 107, 47, -1, 107, 14, 47, -1, 
            14, 49, 47, -1, 49, 119, 47, -1, 107, 48, 14, -1, 48, 108, 14, -1, 
            108, 49, 14, -1, 49, 108, 51, -1, 108, 109, 51, -1, 
            119, 49, 51, -1, 51, 109, 15, -1, 109, 50, 15, -1, 
            50, 110, 15, -1, 110, 52, 15, -1, 52, 119, 15, -1, 
            119, 51, 15, -1, 52, 110, 16, -1, 119, 52, 16, -1, 
            16, 53, 17, -1, 53, 111, 17, -1, 119, 16, 17, -1, 111, 112, 17, -1, 
            112, 55, 17, -1, 55, 47, 17, -1, 47, 119, 17, -1, 112, 54, 55, -1, 
            54, 113, 55, -1, 55, 113, 18, -1, 113, 114, 18, -1, 
            13, 55, 18, -1, 18, 114, 19, -1, 114, 115, 19, -1, 
            18, 19, 56, -1, 19, 115, 56, -1, 115, 116, 56, -1, 
            12, 18, 56, -1, 116, 57, 56, -1, 57, 12, 56, -1, 57, 116, 58, -1, 
            116, 117, 58, -1, 59, 57, 58, -1, 117, 100, 58, -1, 
            100, 59, 58, -1]
          texCoordIndex [
            20, 60, 37, -1, 62, 61, 0, -1, 61, 20, 0, -1, 63, 62, 0, -1, 
            63, 0, 21, -1, 0, 20, 21, -1, 20, 33, 21, -1, 63, 21, 1, -1, 
            21, 33, 1, -1, 65, 64, 2, -1, 64, 1, 2, -1, 22, 65, 2, -1, 
            66, 22, 2, -1, 1, 23, 2, -1, 66, 2, 23, -1, 66, 23, 3, -1, 
            67, 66, 3, -1, 23, 24, 3, -1, 68, 67, 3, -1, 24, 68, 3, -1, 
            69, 68, 4, -1, 68, 24, 4, -1, 24, 70, 4, -1, 25, 70, 5, -1, 
            70, 24, 5, -1, 24, 23, 5, -1, 23, 26, 5, -1, 26, 71, 6, -1, 
            71, 25, 6, -1, 25, 5, 6, -1, 5, 26, 6, -1, 7, 71, 26, -1, 
            118, 7, 26, -1, 27, 72, 8, -1, 72, 80, 8, -1, 80, 7, 8, -1, 
            7, 118, 8, -1, 118, 27, 8, -1, 73, 72, 29, -1, 72, 27, 29, -1, 
            27, 118, 29, -1, 118, 26, 29, -1, 23, 1, 9, -1, 30, 73, 9, -1, 
            73, 29, 9, -1, 29, 26, 9, -1, 26, 23, 9, -1, 74, 30, 32, -1, 
            30, 9, 32, -1, 9, 1, 32, -1, 1, 33, 32, -1, 75, 74, 10, -1, 
            74, 32, 10, -1, 32, 33, 10, -1, 75, 10, 33, -1, 20, 34, 33, -1, 
            34, 75, 33, -1, 20, 37, 34, -1, 35, 34, 11, -1, 34, 37, 11, -1, 
            37, 60, 38, -1, 60, 76, 38, -1, 76, 83, 38, -1, 20, 92, 60, -1, 
            92, 76, 60, -1, 20, 61, 92, -1, 64, 93, 1, -1, 93, 64, 77, -1, 
            64, 65, 77, -1, 65, 22, 77, -1, 22, 66, 78, -1, 66, 67, 78, -1, 
            39, 78, 67, -1, 68, 39, 67, -1, 86, 39, 68, -1, 69, 79, 68, -1, 
            79, 86, 68, -1, 69, 4, 79, -1, 4, 70, 79, -1, 7, 80, 71, -1, 
            80, 72, 28, -1, 72, 73, 28, -1, 73, 31, 28, -1, 73, 30, 31, -1, 
            30, 74, 31, -1, 11, 36, 35, -1, 36, 82, 35, -1, 82, 81, 35, -1, 
            11, 37, 36, -1, 37, 38, 36, -1, 38, 83, 36, -1, 83, 82, 36, -1, 
            76, 84, 83, -1, 84, 90, 83, -1, 76, 92, 84, -1, 77, 94, 93, -1, 
            95, 94, 77, -1, 77, 22, 95, -1, 22, 78, 95, -1, 78, 85, 95, -1, 
            40, 85, 78, -1, 78, 39, 40, -1, 39, 86, 40, -1, 79, 87, 86, -1, 
            80, 28, 98, -1, 31, 98, 28, -1, 74, 98, 31, -1, 74, 75, 88, -1, 
            75, 116, 88, -1, 75, 34, 116, -1, 34, 35, 116, -1, 
            81, 82, 89, -1, 83, 90, 82, -1, 90, 89, 82, -1, 84, 91, 90, -1, 
            91, 101, 90, -1, 84, 92, 91, -1, 41, 95, 85, -1, 40, 41, 85, -1, 
            40, 86, 41, -1, 87, 96, 86, -1, 79, 70, 87, -1, 25, 71, 97, -1, 
            71, 80, 97, -1, 80, 53, 97, -1, 80, 98, 53, -1, 74, 99, 98, -1, 
            74, 88, 99, -1, 35, 117, 116, -1, 35, 81, 117, -1, 
            81, 100, 117, -1, 81, 89, 100, -1, 89, 101, 100, -1, 
            90, 101, 89, -1, 91, 59, 101, -1, 92, 46, 91, -1, 92, 61, 46, -1, 
            61, 102, 46, -1, 61, 62, 102, -1, 62, 103, 102, -1, 
            62, 63, 103, -1, 63, 104, 103, -1, 63, 105, 104, -1, 
            63, 1, 105, -1, 1, 93, 105, -1, 93, 106, 105, -1, 93, 94, 106, -1, 
            94, 95, 106, -1, 47, 106, 95, -1, 41, 47, 95, -1, 42, 47, 41, -1, 
            41, 86, 42, -1, 86, 96, 42, -1, 96, 107, 42, -1, 107, 96, 48, -1, 
            96, 87, 48, -1, 87, 70, 48, -1, 70, 108, 48, -1, 70, 25, 108, -1, 
            25, 109, 108, -1, 109, 25, 50, -1, 25, 97, 50, -1, 
            97, 110, 50, -1, 97, 53, 110, -1, 53, 16, 110, -1, 
            98, 111, 53, -1, 98, 43, 111, -1, 43, 112, 111, -1, 
            54, 112, 43, -1, 98, 99, 43, -1, 99, 44, 43, -1, 44, 113, 43, -1, 
            113, 54, 43, -1, 99, 45, 44, -1, 45, 114, 44, -1, 114, 113, 44, -1, 
            99, 88, 45, -1, 88, 115, 45, -1, 115, 114, 45, -1, 
            88, 116, 115, -1, 101, 59, 100, -1, 91, 46, 59, -1, 
            102, 12, 46, -1, 12, 57, 46, -1, 57, 59, 46, -1, 102, 103, 12, -1, 
            103, 104, 12, -1, 18, 12, 13, -1, 12, 104, 13, -1, 
            104, 105, 13, -1, 55, 13, 105, -1, 55, 105, 106, -1, 
            47, 55, 106, -1, 42, 107, 47, -1, 107, 14, 47, -1, 
            14, 49, 47, -1, 49, 119, 47, -1, 107, 48, 14, -1, 48, 108, 14, -1, 
            108, 49, 14, -1, 49, 108, 51, -1, 108, 109, 51, -1, 
            119, 49, 51, -1, 51, 109, 15, -1, 109, 50, 15, -1, 
            50, 110, 15, -1, 110, 52, 15, -1, 52, 119, 15, -1, 
            119, 51, 15, -1, 52, 110, 16, -1, 119, 52, 16, -1, 
            16, 53, 17, -1, 53, 111, 17, -1, 119, 16, 17, -1, 111, 112, 17, -1, 
            112, 55, 17, -1, 55, 47, 17, -1, 47, 119, 17, -1, 112, 54, 55, -1, 
            54, 113, 55, -1, 55, 113, 18, -1, 113, 114, 18, -1, 
            13, 55, 18, -1, 18, 114, 19, -1, 114, 115, 19, -1, 
            18, 19, 56, -1, 19, 115, 56, -1, 115, 116, 56, -1, 
            12, 18, 56, -1, 116, 57, 56, -1, 57, 12, 56, -1, 57, 116, 58, -1, 
            116, 117, 58, -1, 59, 57, 58, -1, 117, 100, 58, -1, 
            100, 59, 58, -1]
          }
      }
    ]
  }
  }
  
  

leg


  
  PROTO Leg [
      exposedField SFRotation kneeBend 0 0 1 0
      exposedField SFRotation ankleBend 0 0 1 0 
  ] {
      Transform {
          rotation IS ankleBend
          children Transform {
              translation 0 0.15 0
              children [
                  Shape {
                      geometry Cylinder { top FALSE height 0.3 radius 0.1 }
                      appearance Appearance {
                          material DEF PANT_MAT Material {
                              diffuseColor 0 0 0.7
                          }
                      }
                  }
                  Transform {
                      translation 0 0.15 0
                      children [
                          Shape {
                              appearance Appearance {
                                  material USE PANT_MAT 
                              }
                              geometry Sphere { radius 0.1 }
                          }
                          Transform {
                              rotation IS kneeBend
                              children Transform {
                                  translation 0 0.15 0
                                  children [
                                      Shape {
                                          geometry Cylinder { top FALSE bottom FALSE height 0.3 radius 0.1 }
                                          appearance Appearance {
                                               material  USE PANT_MAT 
                                          }
                                      }
                                  ]
                              }
                          }
                      ]
                  } 
              ]
          }
      }
  }
  
  

arm


  
  PROTO Arm [
      exposedField SFRotation elbowBend 0 0 1 0
      exposedField SFRotation shoulderBend 0 0 1 0 
  ] {
      Transform {
          rotation IS shoulderBend
          children [
              Shape {
                  appearance Appearance {
                      material DEF ARM_MAT Material {
                          diffuseColor 0.4 0.4 0.7
                      }
                  }
                  geometry Sphere { radius 0.08 }
              }
              Transform {
              translation 0 -0.15 0
              children [
                  Shape {
                      geometry Cylinder { top FALSE height 0.3 radius 0.08 }
                      appearance Appearance {
                          material USE ARM_MAT 
                      }
                  }
                  Transform {
                      translation 0 -0.15 0
                      children [
                          Shape {
                              appearance Appearance {
                                  material USE ARM_MAT 
                              }
                              geometry Sphere { radius 0.08 }
                          }
                          Transform {
                              rotation IS elbowBend
                              children Transform {
                                  translation 0 -0.15 0
                                  children [
                                      Shape {
                                          geometry Cylinder { top FALSE bottom FALSE height 0.3 radius 0.08 }
                                          appearance Appearance {
                                              material USE ARM_MAT 
                                          }
                                      }
                                  ]
                              }
                          }
                      ]
                  } 
              ]
          }
      ]
      }
  }
  
  

pants


  
  PROTO Pants [
      exposedField MFNode body []
  ] {
      Transform { ## Left Leg
          rotation 1 0 0 -0.2
          translation 0.05 0.2 0.2
          children [
              Leg {
                  kneeBend 0 0 1 -0.5
                  ankleBend 0 0 1 0.5
              }
          ]
      }
      Transform { ## Right Leg
          rotation 1 0 0 0.2
          translation 0.05 0.2 -0.2
          children [
              Leg {
                  kneeBend 0 0 1 -0.5
                  ankleBend 0 0 1 0.1
              }
          ]
      }
      Transform { ## Butt
          rotation 0 1 0  0.6
          translation 0 0.85 0
          children [
              Shape {
                  geometry Box { size 0.6 0.3 0.3  }
                  appearance Appearance {
                      material DEF PANT_MAT Material {
                          diffuseColor 0 0 0.7
                      }
                  }
              }
              Transform {
                  rotation 0 1 0 -0.3
                  translation 0 0.15 0
                  children IS body
              }
          ]
      }
  }
  
  

jacket


  
  PROTO Jacket [
  ] {
      Transform {
          translation 0 0.3 0
          children [
              Shape {
                  geometry Box { size 0.6 0.6 0.3  }
                  appearance Appearance {
                      material DEF PANT_MAT Material {
                          diffuseColor 0 0 0.7
                      }
                  }
              }
              Transform { ## Right Arm
                  translation 0.3 0.25 0
                  rotation 0 1 0 0.2
                  children [
                      Arm {
                          shoulderBend 0 0 1 1.1
                          elbowBend 1 0 0 0.5
                      }
                  ]
              }
              Transform { ## Left Arm
                  translation -0.3 0.25 0
                  rotation 0 1 0 -0.4
                  children [
                      Arm {
                          shoulderBend 0 0 1 -1.1
                          elbowBend 1 0 0 0.5
                      }
                  ]
              }
              Transform {
                  translation 0 0.4 0
                  children [
                      Cylinder { height 0.2 radius 0.06 }
                      Transform {
                          translation 0 0.2 0
                          children [
                              Sphere { radius 0.2 }
                          ]
                      }
                  ]
              }
          ]
      }
  }
  
  

boarder


  
  PROTO Boarder [
      exposedField SFVec3f position 0 0 0
      exposedField SFRotation orientation 0 1 0 0
  
      eventIn      SFBool bindViewpoint
  
      field MFNode board []
      field MFNode boot   []
  ] {
  
      Transform {
          translation IS position
          children [
              DEF VIEW1 Viewpoint {
                 bind IS bindViewpoint
                 position 0 6 4
                 orientation  1 0 0 -1.0
                 description "Cool Boarder 1"
              }
              DEF VIEW2 Viewpoint {
                 position -6 1.6 0
                 orientation  0 1 0  -1.57
                 description "Cool Boarder 2"
              }
          ]
      }
      Transform {
          translation IS position
          rotation IS orientation
          children [
              Group {
                  children IS board
              }
              Transform {
                  translation 0 0  -0.2
                  rotation 0 1 0 1.4
                  children IS boot
              }
              Transform {
                  translation 0 0 0.2 
                  rotation 0 1 0 1.57
                  children IS boot
              }
              Pants {
                  body Jacket {}
              }
          ]
      }
  }
  
  

do not navigate


  
  NavigationInfo {
      type ["NONE"]
  }
  
  

script


  
  DEF MAIN_SCRIPT Script {
      eventIn  MFString topTexture_set
      eventIn  MFString baseTexture_set
      field    MFString topTexture  "local/skate/boards/top_killerloop_99.jpg"
      field    MFString baseTexture "local/skate/boards/base_killerloop_99.jpg"
      eventOut MFString topTexture_changed
      eventOut MFString baseTexture_changed
      eventIn  SFTime   goButtonPressed
  
      eventOut SFInt32 setMainSwitch
  
      eventOut SFBool  startGame 
  
      url "javascript: 
          function goButtonPressed(v,t) {
              topTexture_changed  = topTexture;
              baseTexture_changed = baseTexture;
              setMainSwitch       = 1;
              startGame           = TRUE;
          }
          function topTexture_set(v,t) {
              topTexture = v;
          }
          function baseTexture_set(v,t) {
              baseTexture = v;
          }
      "
  }
  
  

switch


  
  DEF MAIN_SWITCH Switch {
      whichChoice 0
      choice [
          Group {
              children [
  
  

do not nest


  
  PROTO SelectableSnowboard [
      eventOut     MFString topTexture_set
      eventOut     MFString baseTexture_set
  
      exposedField MFString topTexture  []
      exposedField MFString baseTexture []
      exposedField SFVec3f  location 0 0 0
      exposedField MFString description []
      eventOut     MFString text_changed
  ] {
      Transform {
          translation IS location
          children [
              DEF CYLINDERSENSOR CylinderSensor {
              }
              DEF TRANS Transform {
                  children Transform {
                      rotation 1 0 0 1.57
                      children Snowboard {
                          topTexture  IS topTexture  
                          baseTexture IS baseTexture
                      }
                  }
              }
          ]
      }
      DEF SCRIPT Script {
          eventIn  SFBool   isActive
          field    MFString description    IS description
          eventOut MFString text_changed   IS text_changed
  
          field    MFString topTexture    IS topTexture  
          field    MFString baseTexture   IS baseTexture
          eventOut MFString topTexture_set  IS topTexture_set
          eventOut MFString baseTexture_set IS baseTexture_set
  
          url "javascript:
              function isActive(v,t) {
                  if(v) {
                      text_changed    = description;
                      topTexture_set  = topTexture;
                      baseTexture_set = baseTexture;
                  }
              }
          "
      }
      ROUTE CYLINDERSENSOR.rotation_changed TO TRANS.set_rotation
      ROUTE CYLINDERSENSOR.isActive         TO SCRIPT.isActive
  }
  
  Transform {
      translation -0.25 1.5 0
      children Shape {
          appearance Appearance {
              material Material {
                  emissiveColor 1 1 1
              }
          }
          geometry DEF SELECTION_TEXT Text {
              string ["Select your board"]
              fontStyle FontStyle {
                  justify ["BEGIN"]
                  size 0.3
              }
          }
      }
  }
  
  Transform {
      translation 2.5 0.5 -1
      children Shape {
          geometry Box{
              size 8 5 0
          }
          appearance Appearance {
              texture ImageTexture {
                  url "local/skate/mountain.jpg"
              }
          }
      }
  }
  
  

boards


  
  DEF BOARDS Group {
      children [
  SelectableSnowboard {
      location 0 0 0
      topTexture  "local/skate/boards/top_airwalk_matrix155_99.jpg"
      baseTexture "local/skate/boards/base_airwalk_matrix155_99.jpg"
      description ["Airwalk",
                   "Matrix 155",
                   "1999-2000"]
  }
  SelectableSnowboard {
      location 0.5 0 0
      topTexture  "local/skate/boards/top_burton_feelgood99.jpg"
      baseTexture "local/skate/boards/base_burton_feelgood99.jpg"
      description ["Burton",
                   "Feelgood",
                   "1999-2000"]
  }
  SelectableSnowboard {
      location 1 0 0
      topTexture  "local/skate/boards/top_killerloop_99.jpg"
      baseTexture "local/skate/boards/base_killerloop_99.jpg"
      description ["Killerloop",
                   "??",
                   "1999-2000"]
  }
  SelectableSnowboard {
      location 1.5 0 0
      topTexture  "local/skate/boards/top_libtech_davelee156z_99.jpg"
      baseTexture "local/skate/boards/base_libtech_davelee156z_99.jpg"
      description ["Lib Technologies",
                   "Dave Lee 156z",
                   "1999-2000"]
  }
  SelectableSnowboard {
      location 2 0 0
      topTexture  "local/skate/boards/top_morrow_unit161_99.jpg"
      baseTexture "local/skate/boards/base_morrow_unit161_99.jpg"
      description ["Morrow",
                   "Unit 161",
                   "1999-2000"]
  }
  SelectableSnowboard {
      location 2.5 0 0
      topTexture  "local/skate/boards/top_palmer_channeltitanium164_99.jpg"
      baseTexture "local/skate/boards/base_palmer_channeltitanium164_99.jpg"
      description ["Palmer",
                   "Channel Titanium 164",
                   "1999-2000"]
  }
  ]
  }
  
  Transform {
      translation 2.5 -0.9 0.1
      children [
          Transform {
              translation 0 -0.08 0.1
              children Shape {
                  appearance Appearance {
                      material Material {
                          diffuseColor 0 0 0
                          specularColor 0 0 0
                          emissiveColor 1 1 1
                      }
                  }
                  geometry Text {
                      string ["GO"]
                      fontStyle FontStyle {
                          justify ["MIDDLE"]
                          size 0.3
                      }
                  }
              }
  
          }
          Shape {
              geometry Box{
                  size 0.6 0.3 0
              }
              appearance Appearance {
                  material Material {
                      diffuseColor 0 0 0
                      specularColor 0 0 0
                      emissiveColor 0.5 0.5 1.0
                  }
              }
          }
          DEF GO_BUTTON_TOUCH TouchSensor {}
      ]
  }
  
  

viewpoint


  
  Viewpoint {
      position 2.25 0.5 4
  }
  
  

script


  
  Script {
      directOutput TRUE
      field SFNode boards USE BOARDS
      field SFNode main   USE MAIN_SCRIPT
      field SFNode text   USE SELECTION_TEXT   
      url "javascript:
          function initialize() {
              var children = boards.children;
              for(i=0;i<children.length;i++) {
                  Browser.addRoute(children[i],'text_changed',
                                   text,'set_string');
                  Browser.addRoute(children[i],'topTexture_set',
                                   main,'topTexture_set');
                  Browser.addRoute(children[i],'baseTexture_set',
                                   main,'baseTexture_set');
              }
          }
      "
  }
  
              ]
          }
          Group {
              children [
  
  Shape {
      appearance Appearance {
          material Material {
              diffuseColor 1 1 1
              emissiveColor 0.5 0.5 0.5
          }
      }
      geometry DEF ELEVATION ElevationGrid {
          normalPerVertex TRUE
          solid           TRUE
          creaseAngle     1
          xDimension 32
          zDimension 200
          xSpacing 1
          zSpacing 1
          height [ ]
      }
  }
  
  
  
  
  
  
  DEF BOARDER Boarder {
      board DEF BOARD Snowboard {
      }
      boot Boot { 
          textureUrl "local/skate/airwalk_freeride.gif"
      }
  }
  
  ROUTE MAIN_SCRIPT.topTexture_changed  TO BOARD.topTexture
  ROUTE MAIN_SCRIPT.baseTexture_changed TO BOARD.baseTexture
  ROUTE MAIN_SCRIPT.startGame           TO BOARDER.bindViewpoint
  
  DEF TIMER TimeSensor {
      enabled FALSE
      loop TRUE
      cycleInterval 10
  }
  ROUTE MAIN_SCRIPT.startGame TO TIMER.enabled
  
  
  
  
  DEF SCRIPT Script {
      directOutput TRUE
  
      eventIn SFTime tick
  
      eventOut SFVec3f position_changed
      eventOut SFRotation orientation_changed
  
      field SFVec3f speed  0 0 0
      field SFVec3f position  16 100 195
      field SFRotation orientation 0 0 1 0
  
      field SFTime oldTick 0
  
      field SFRotation rotA 0 0 1 0
      field SFRotation rotB 0 0 1 0
      field SFVec3f defDirection 0 0 1
      field SFVec3f direction 0 0 1
      field SFVec3f yAxis 0 1 0
      field SFVec3f up 0 1 0
  
      field SFVec3f nose 0 0 0
      field SFVec3f tail 0 0 0
  
      field MFFloat height []
      field SFNode elevation USE ELEVATION
  
      field    SFInt32 oldMask   0
      field    SFNode  me        USE SCRIPT
  
      eventIn  SFNode   onEvent
  
      field SFBool upk FALSE
      field SFBool down  FALSE
      field SFBool left FALSE
      field SFBool right FALSE
      field SFBool space FALSE
  
      field SFInt32 k_upk   1004 ##38
      field SFInt32 k_down  1005 ##40
      field SFInt32 k_left  1006 ##37
      field SFInt32 k_right 1007 ##39
      field SFInt32 k_space 32
  
      url "javascript:
          function connectKeyboard() {
              // tell what events
              oldMask = Browser.eventMask;
              Browser.eventMask = ((1<<5) | (1<<6)); // KeyDown Only...
              // add event observer
              Browser.addRoute(Browser,'event_changed',me,'onEvent');
          }
          function disconnectKeyboard()
          {
              // remove event observer
              Browser.deleteRoute(Browser,'event_changed',me,'onEvent');
              Browser.eventMask = oldMask;
          }
          function onEvent(e,t) {
              if (e.type == 'keydown') {
                  if(e.keyCode == k_left) {
                      left = TRUE;
                     e.returnValue = false;
                  } else if(e.keyCode == k_upk) {
                      upk = TRUE;
                     e.returnValue = false;
                  } else if(e.keyCode == k_right) {
                      right = TRUE;
                     e.returnValue = false;
                  } else if(e.keyCode == k_down) {
                      down = TRUE;
                     e.returnValue = false;
                  } else if(e.keyCode == k_space) {
                      space = TRUE;
                     e.returnValue = false;
                  }
              } else if (e.type == 'keyup') {
                  if(e.keyCode == k_left) {
                      left = FALSE;
                     e.returnValue = false;
                  } else if(e.keyCode == k_upk) {
                      upk = FALSE;
                     e.returnValue = false;
                  } else if(e.keyCode == k_right) {
                      right = FALSE;
                     e.returnValue = false;
                  } else if(e.keyCode == k_down) {
                      down = FALSE;
                     e.returnValue = false;
                  } else if(e.keyCode == k_space) {
                      space = FALSE;
                     e.returnValue = false;
                  }
              } else {
                  Browser.print('Unknown event : '+e.type);
              }
          }
  
          function initialize() {
              connectKeyboard();
  
              var i = 0;
              var j = 0;
              var p = 0;
              var y = 0;
              for (i=0;i<200;i++) {
                  for (j=0;j<32;j++) {
                      height[p] = y + (Math.random()-0.5)/3;
                      p = p + 1;
                  }
                  y = y + 0.5;
  if(i==50) y = y +3;
              }
              elevation.height = height;
          }
  
          function tick(v,t) {
              if(oldTick == 0) {
                  oldTick = v;
              }
              while (oldTick < v) {
                  update();
                  oldTick = oldTick + 0.05;
              }
          }
          function update() {
                if(position[2] <= 0) return;
                position[0] = position[0] + speed[0];
                position[1] = position[1] + speed[1];
                position[2] = position[2] + speed[2];
  
                var h = getHeight(position[0],position[2]);
                if(h>position[1]) {
                    position[1] = h;
                    speed[1] = 0;
                } 
                position_changed = position;
   
                var realNose = (orientation.multVec(new SFVec3f(0,0,-0.4))).add(position);
                nose[0] = realNose[0];
                nose[2] = realNose[2];
                nose[1] = getHeight(nose[0],nose[2]);
  
                var realTail = (orientation.multVec(new SFVec3f(0,0,0.4))).add(position);
                tail[0] = realTail[0];
                tail[2] = realTail[2];
                tail[1] = getHeight(tail[0],tail[2]);
  
                var dl = Math.sqrt(direction[0]*direction[0]+direction[2]*direction[2]);
                var accel = 0.01 + (direction.dot(yAxis)  * dl)/200;
  if(realTail[1] < realNose[1]) accel = -accel;
                speed[0] = speed[0]- (direction[0]*accel)/3;
                speed[1] = speed[1] - 0.10; // gravity
                speed[2] = speed[2]- (direction[2]*accel)/3;
  //Browser.print('[spd]  '+ speed);
  
  // Do somphin with rotation only,
  // and keep speed constant when jumpin...
  // Also do 'fall' check when landing...
                if(realNose[1]>(nose[1]+0.2))  {// 'flying', don't adjust orientation
                    direction = realTail.subtract(realNose);
                } else {
                    direction = tail.subtract(nose);
                }
  
  if(left) {
      var S = Math.sqrt(speed[0]*speed[0]+speed[2]*speed[2]) * 0.99;
      direction = (new SFRotation(0,1,0,0.1)).multVec(direction);
      var L = Math.sqrt(direction[0]*direction[0]+direction[2]*direction[2]);
      if(Math.atan(speed.dot(direction)) > 0)  { // reverse
          speed[0] = S*(direction[0]/L);
          speed[2] = S*(direction[2]/L);
      } else {
          speed[0] = -S*(direction[0]/L);
          speed[2] = -S*(direction[2]/L);
      }
  }
  if(right) {
      var S = Math.sqrt(speed[0]*speed[0]+speed[2]*speed[2]) * 0.99;
      direction = (new SFRotation(0,1,0,-0.1)).multVec(direction);
      var L = Math.sqrt(direction[0]*direction[0]+direction[2]*direction[2]);
      if(Math.atan(speed.dot(direction)) > 0)  { // reverse
          speed[0] = S*(direction[0]/L);
          speed[2] = S*(direction[2]/L);
      } else {
          speed[0] = -S*(direction[0]/L);
          speed[2] = -S*(direction[2]/L);
      }
  }
  if(upk) {
      direction = (new SFRotation(1,0,0,-0.2)).multVec(direction);
  }
  if(down) {
      direction = (new SFRotation(1,0,0,0.2)).multVec(direction);
  }
                rotA            = new SFRotation(defDirection,
                                                 direction);
                up             = rotA.multVec(yAxis);
                rotB            = new SFRotation(
                                         direction.cross(up),
                                         direction.cross(yAxis));
  
                orientation = rotA.multiply(rotB);
                orientation_changed = orientation;
  
          }
          function getHeight(x,z) {
              if(x<0 || x>=31) return 0;
              if(z<0 || z>=199) return 0;
         
              var xfl = Math.floor(x);
              var zfl = Math.floor(z);
              var i = xfl + zfl*32;
              var hxz = height[i];             
              var hx1z = height[i+1];             
              var hxz1 = height[i+32];             
              var hx1z1= height[i+33];
  
              var hz0 = (hxz+((hx1z-hxz)*(x-xfl)));
              var hz1 = (hxz1+((hx1z1-hxz1)*(x-xfl)));           
              var h = hz0 + ((hz1-hz0)*(z-zfl));
  
              return h;
          }
      "
  }
  
  ROUTE TIMER.time_changed TO SCRIPT.tick
  ROUTE SCRIPT.position_changed TO BOARDER.position
  ROUTE SCRIPT.orientation_changed TO BOARDER.orientation
  
              ]
          }
      ]
  }
  
  ROUTE MAIN_SCRIPT.setMainSwitch TO MAIN_SWITCH.set_whichChoice
  ROUTE GO_BUTTON_TOUCH.touchTime TO MAIN_SCRIPT.goButtonPressed
  
  


(C) A. Eliëns 21/5/2007

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.