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-x-emotionavatar.vr

web3d-x-emotionavatar.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

Web3D/VR

avatar with emotions


  
  

swinging arm


  
  PROTO SwingingArm [
      exposedField SFVec3f    translation 0 0 0
      exposedField SFRotation orientation 0 0 1 0
      exposedField MFNode     children    []
      eventIn      MFNode     addChildren 
      eventIn      MFNode     removeChildren 
      exposedField SFFloat    transparency 0.5
  ]{
      DEF MOVEPOINT Transform {
          translation    IS translation
          rotation       IS orientation
          children [
              Transform {
                  translation -0.1 0 0
                  children [
                      Group {
                          children [
                              Shape {
                                  appearance DEF GRAY Appearance {
                                      material Material {
                                          transparency IS transparency
                                          diffuseColor  0.4 0.4 0.8
                                          emissiveColor 0.4 0.4 0.8
                                      }
                                  }
                                  geometry Box { size 0.2 0.025 0.025 }
                              }
                              DEF DRAGSENSOR PlaneSensor { 
                                  minPosition 0 0 
                                  maxPosition 1 1
                              }
                          ]
                      }
                      Transform {
                          translation -0.1 0 0 
                          children [
                              Group {
                                  children [
                                      Shape {
                                          appearance Appearance { 
                                              material Material {
                                                  transparency IS transparency
                                                  diffuseColor  1.8 0.8 0.8
                                                  emissiveColor 1.8 0.8 0.8
                                              }
                                          }
                                          geometry Sphere { 
                                              radius 0.025 
                                          }
                                      }
                                      DEF ROTATESENSOR PlaneSensor { 
                                          minPosition -0.314 -0.157
                                          maxPosition 0 0.157
                                      }
                                  ]
                              }
                              DEF ROTATEPOINT Transform {
                                  children [
                                      Transform {
                                          translation -.125 0 0 
                                          children [ 
                                              Shape {
                                                  appearance USE GRAY
                                                  geometry Box { 
                                                      size 0.25 0.025 0.025 
                                                  }
                                              }
                                              DEF CONNECTPOINT Transform {
                                                  translation -0.15 0 0.03 
                                                  children       IS children
                                                  addChildren    IS addChildren
                                                  removeChildren IS removeChildren
                                              }
                                          ]
                                      }
                                  ]
                              }
                          ]
                      }
                  ]
              }
          ]    
      }
  
  

window script


  
  DEF SCRIPT Script {
  
          eventIn SFFloat     aspectRatio
  
  
          eventIn  SFVec3f    setRotateTrans
          eventOut SFRotation rotation_changed
  
  
          eventIn  SFBool     doDrag
          eventIn  SFVec3f    setDragTrans
          eventOut SFVec3f    newPos
          eventOut SFRotation armRotation
          eventOut SFRotation correctionRotation
  
  
          field    SFVec3f    orgPos IS translation
          field    SFVec3f    pos           0 0 0
          field    SFRotation orgRot        0 0 1 0
          field    SFRotation correctionRot 0 0 1 0
  
  
          field    SFFloat    xCenter  0
          field    SFFloat    yCenter  0
          field    SFFloat    left    -2
          field    SFFloat    right    2
          field    SFFloat    top      0.95
          field    SFFloat    bottom  -0.95
          field    SFFloat    yfov  0.785398
          field    SFFloat    xfov  0.785398
          field    SFNode     node NULL
  
  

javascript functions


  
          url "vrmlscript:
              function initialize() {
                  setWindowRect(Browser.windowAspect);
                  pos = orgPos;
                  correctPosition();
              }
              function aspectRatio(value,time) {
                  setWindowRect(value);
                  correctPosition();
              }
              function setWindowRect(aspect) {
                  if(aspect>1) {
                  // if aspect>1, Y is constant, so X is relative to AspectRatio
                      node   = Browser.boundViewpoint;
                      //print (' 1: ratio == ' + aspect);
                      //yfovx   = node.fieldOfView;
                      //print (' 1: yfovx == ' + yfovx);
                      if (yfov==0) { yfov = 0.785398; }
                      //xfov = Math.atan(aspect*(Math.tan(yfov/2)))*2;
                      right  = (aspect*(Math.tan(yfov/2))) * 2.0 + 0.1;
                      top    =  0.95;
                  } else {
                  // if aspect<1, X is constant, so Y is relative to AspectRatio
                      //xfov   = Browser.boundViewpoint.fieldOfView;
                      if(xfov==0) { xfov = 0.785398; }
                      //yfov = Math.atan((Math.tan(yfov/2))/aspect)*2;
                      right  = 0.95;
                      top    = ((Math.tan(xfov/2))/aspect) * 2.0 + 0.1;
                  }
  
                  //print ('ratio == ' + aspect);
                  //print ('yfov == ' + yfov);
                  //print ('xfov == ' + xfov);
                  //print ('angleRatio == ' + angleRatio);
  
                  left   = -right;
                  bottom = -top;
              }
  
              function setRotateTrans (value,time) {
                  rotA =  new SFRotation(0,1,0, value.x*10);
                  rotB =  new SFRotation(1,0,0,-value.y*10);
                  rotation_changed = rotA.multiply(rotB);
              }
              function doDrag(value,time) {
                  if(!value) {
                      orgPos = pos;
                  } else {
                      pos = orgPos;
                      correctionRot = orgRot;
                  }
              }
              function correctPosition() {
  
                  // Snap position to edge of screen
                  dx = 0;
                  dy = 0;
                  if(pos.x > xCenter) { dx = right-pos.x; }
                  else                { dx = pos.x-left; }
                  if(pos.y < yCenter) { dy = pos.y-bottom; }
                  else                { dy = top-pos.y; }
  
                  if(dx<dy) {
                      if(pos.x > xCenter) {
                          armRotation        = new SFRotation(0,0,1,0);
                          correctionRotation = new SFRotation(0,0,1,0);
                          orgRot             = new SFRotation(0,0,1,0);
                          pos.x              = right;
                      } else {
                          armRotation        = new SFRotation(0,0,1, 3.14);
                          correctionRotation = new SFRotation(0,0,1,-3.14);
                          orgRot             = new SFRotation(0,0,1, 3.14);
                          pos.x              = left;
                      }
                  } else /* dy<dx */ {
                      if(pos.y < yCenter) {
                          armRotation        = new SFRotation(0,0,1,-1.57);
                          correctionRotation = new SFRotation(0,0,1, 1.57);
                          orgRot             = new SFRotation(0,0,1,-1.57);
                          pos.y              = bottom;
                      } else {
                          armRotation        = new SFRotation(0,0,1, 1.57);
                          correctionRotation = new SFRotation(0,0,1,-1.57);
                          orgRot             = new SFRotation(0,0,1, 1.57);
                          pos.y              = top;
                      }
                  }
  
                  // Limit position to screen 
                  if(pos.y < bottom) { pos.y = bottom; } 
                  if(pos.y > top)    { pos.y = top; } 
                  if(pos.x < left)   { pos.x = left; } 
                  if(pos.x > right)  { pos.x = right; } 
  
                  newPos = pos;
              }
              function setDragTrans (value,time) {
                  rotVal = correctionRot.multVec(value);
                  pos    = new SFVec3f();
                  pos.x  = orgPos.x + rotVal.x;
                  pos.y  = orgPos.y + rotVal.y;
                  pos.z  = orgPos.z;
                  correctPosition();
              }
          "
      }
  
  

additional script


  
      Script { ## To setup some ROUTES that cannot be defined statically
          field SFNode script USE SCRIPT
          url "vrmlscript:
              function initialize()
              {
                 Browser.addRoute(Browser,'windowAspect',script,'aspectRatio');
              }
              function shutdown()
              {
                 Browser.removeRoute(Browser,'windowAspect',script,'aspectRatio');
              }
          "
      }
  
  

routing


  
      ROUTE ROTATESENSOR.translation_changed TO SCRIPT.setRotateTrans
  
      ROUTE SCRIPT.rotation_changed          TO ROTATEPOINT.rotation
  
  
      ROUTE DRAGSENSOR.isActive                TO SCRIPT.doDrag
      ROUTE DRAGSENSOR.trackPoint_changed      TO SCRIPT.setDragTrans
  
      ROUTE SCRIPT.newPos                      TO MOVEPOINT.translation
      ROUTE SCRIPT.armRotation                 TO MOVEPOINT.rotation
      ROUTE SCRIPT.correctionRotation          TO CONNECTPOINT.rotation
  }
  
  

emotion disc


  
  DEF EMOTION_DISC Transform {
      translation 0 0.94  8.15
      scale       0.4 0.5 0.5
      children [
          Appearance { 
              material Material { 
                  diffuseColor  0.0 0.0 0.0 
              } 
          } 
          DEF FACE_ELT Transform {
              scale        0.00194363 0.00238663 0.002
              rotation     1 0 0 3.1415
              translation  -1.0 1.0 0
              children [
                  Transform {
                      translation 80 30 0
                      children DEF L_EYE_TRANS Transform {
                          translation 329 274 0
                          children DEF L_EYE Sphere { radius 20 }
                      }
                  }
                  Transform {
                      translation 125 30 0
                      children DEF R_EYE_TRANS Transform {
                          translation  521 272 0
                          children DEF R_EYE Sphere { radius 20 }
                      }
                  }
                  Transform {
                      translation 30 30 0
                      children DEF R_BROW_TRANS Transform {
                          translation 514 220 0
                          children DEF R_BROW Extrusion {
                              orientation 0 0 1 0
                              spine [ 0 0 0, 22 -19 0, 94 -1 0]
                              scale [2 2, 10 10, 2 2]
                          }
                      }
                  }
                  Transform {
                      translation 170 30 0
                      children DEF L_BROW_TRANS Transform {
                          translation 339 220 0
                          children DEF L_BROW Extrusion {
                              orientation 0 0 1 0
                              spine [ 0 0 0, -22 -19 0, -94 4 0]
                              scale [2 2, 10 10, 2 2]
                          }
                      }
                  }
  Transform { translation 0 -80 0 children
                  Transform {
                      translation 500 560 0 
                      children DEF MOND_TRANS Transform {
                          children DEF MOUTH Extrusion {
                              orientation 0 0 1 0
                              spine [ -36 -38 0, 33 -20 0, 107 -41 0]
                              scale [10 10, 10 10, 2 2]
                          }
                      }
                  }
  }
              ]
          }
          DEF MOON_ANIM Script {
              directOutput TRUE
              field SFNode rBrowTrans USE R_BROW_TRANS
              field SFNode rBrowShape USE R_BROW
              field SFNode lBrowTrans USE L_BROW_TRANS
              field SFNode lBrowShape USE L_BROW
              field SFNode mouthShape USE MOUTH
              field MFVec3f spine [0 0 0, 0 0 0, 0 0 0]
              eventIn MFFloat setFrame
  
  

scripting


              url "vrmlscript:
                  function setFrame(values,time) {
                      rBrowTrans.translation[0] = values[ 0];
                      rBrowTrans.translation[1] = values[ 1];
                      spine[0] = new SFVec3f(0,0,0);
                      spine[1] = new SFVec3f(values[ 2],values[ 3],0);
                      spine[2] = new SFVec3f(        94,values[ 4],0);
                      rBrowShape.set_spine = spine;
  
                      lBrowTrans.translation[0] = values[ 5];
                      lBrowTrans.translation[1] = values[ 6];
                      spine[0] = new SFVec3f(0,0,0);
                      spine[1] = new SFVec3f(values[ 7],values[ 8],0);
                      spine[2] = new SFVec3f(       -94,values[ 9],0);
                      lBrowShape.set_spine = spine;
  
                      spine[0] = new SFVec3f(values[10],values[11],0);
                      spine[1] = new SFVec3f(values[12],values[13],0);
                      spine[2] = new SFVec3f(values[14],values[15],0);
                      mouthShape.set_spine = spine;
                  }
              "
          }
  
  

interpolators


  DEF INTERPOLATOR Script {
  field MFFloat neutral [339  220  22  -19  -1  514  220  -22  -19  -1  -36  -38  33  -20  107  -41  ]
  ##Joy
  field MFFloat joy_01 [339  220  22  -19  -1  514  220  -22  -19  -1  -36  -38  33  -20  107  -41  ]
  field MFFloat joy_02 [339  220  22  -20  -2  514  220  -22  -20  -2  -39  -41  33  -20  110  -44  ]
  field MFFloat joy_03 [339  220  22  -20  -2  514  220  -22  -20  -2  -41  -44  33  -20  112  -47  ]
  field MFFloat joy_04 [339  220  22  -21  -3  514  220  -22  -21  -3  -44  -47  33  -21  115  -50  ]
  field MFFloat joy_05 [339  220  22  -21  -3  514  220  -22  -21  -4  -46  -50  33  -21  118  -53  ]
  field MFFloat joy_06 [339  220  22  -22  -4  514  220  -21  -22  -4  -49  -52  33  -21  120  -55  ]
  field MFFloat joy_07 [339  220  22  -22  -4  514  220  -21  -22  -5  -51  -55  33  -21  123  -58  ]
  field MFFloat joy_08 [339  220  22  -23  -5  514  220  -21  -23  -6  -54  -58  33  -22  126  -61  ]
  field MFFloat joy_09 [339  220  22  -23  -5  514  220  -21  -23  -6  -56  -61  33  -22  128  -64  ]
  field MFFloat joy_10 [339  220  22  -24  -6  514  220  -21  -24  -7  -59  -64  33  -22  131  -67  ]
  ##Disgust
  field MFFloat disgust_01 [339  220  22  -19  -1  514  220  -22  -19  -1  -36  -38  33  -20  107  -41 ] 
  field MFFloat disgust_02 [339  220  23  -15  4  514  218  -22  -16  6  -37  -34  36  -24  106  -38  ]
  field MFFloat disgust_03 [339  219  24  -11  9  514  217  -22  -12  13  -38  -30  39  -27  104  -36  ]
  field MFFloat disgust_04 [339  219  25  -7  14  514  215  -22  -9  19  -39  -26  42  -31  103  -33  ]
  field MFFloat disgust_05 [339  218  26  -3  19  514  213  -22  -5  26  -40  -22  45  -34  101  -31 ] 
  field MFFloat disgust_06 [339  218  27  0  25  514  212  -21  -2  33  -42  -19  47  -38  100  -28 ] 
  field MFFloat disgust_07 [339  217  28  4  30  514  210  -21  2  40  -43  -15  50  -41  98  -26  ]
  field MFFloat disgust_08 [339  217  29  8  35  514  208  -21  5  46  -44  -11  53  -45  97  -23  ]
  field MFFloat disgust_09 [339  216  30  12  40  514  207  -21  9  53  -45  -7  56  -48  95  -21  ]
  field MFFloat disgust_10 [339  216  31  16  45  514  205  -21  12  60  -46  -3  59  -52  94  -18  ]
  ##Anger
  field MFFloat anger_01 [339  220  22  -19  -1  514  220  -22  -19  -1  -36  -38  33  -20  107  -41  ]
  field MFFloat anger_02 [340  218  27  -14  -1  513  218  -26  -14  -1  -37  -32  33  -23  108  -36 ] 
  field MFFloat anger_03 [340  216  32  -9  -1  513  216  -31  -9  -1  -38  -27  33  -25  109  -31  ]
  field MFFloat anger_04 [341  214  36  -4  -1  512  214  -35  -4  -1  -39  -21  33  -28  111  -25 ] 
  field MFFloat anger_05 [341  212  41  1  -1  511  212  -40  1  -1  -40  -15  33  -31  112  -20  ]
  field MFFloat anger_06 [342  209  46  6  -1  511  209  -44  6  -1  -41  -10  33  -33  113  -15  ]
  field MFFloat anger_07 [342  207  51  11  -1  510  207  -49  11  -1  -42  -4  33  -36  114  -10 ] 
  field MFFloat anger_08 [343  205  55  16  -1  509  205  -53  16  -1  -43  2  33  -39  116  -4  ]
  field MFFloat anger_09 [343  203  60  21  -1  509  203  -58  21  -1  -44  7  33  -41  117  1  ]
  field MFFloat anger_10 [344  201  65  26  -1  508  201  -62  26  -1  -45  13  33  -44  118  6  ]
  ##Sad
  field MFFloat sad_01 [339  220  22  -19  -1  514  220  -22  -19  -1  -36  -38  33  -20  107  -41  ]
  field MFFloat sad_02 [339  220  27  -19  -6  514  220  -26  -19  -6  -37  -34  33  -20  107  -36  ]
  field MFFloat sad_03 [339  220  32  -19  -11  514  220  -31  -19  -11  -38  -29  33  -20  107  -31 ] 
  field MFFloat sad_04 [339  220  36  -19  -15  514  220  -35  -19  -15  -39  -25  33  -20  107  -25  ]
  field MFFloat sad_05 [339  220  41  -19  -20  514  220  -40  -19  -20  -40  -21  33  -20  107  -20  ]
  field MFFloat sad_06 [339  220  46  -19  -25  514  220  -44  -19  -25  -41  -16  33  -20  107  -15  ]
  field MFFloat sad_07 [339  220  51  -19  -30  514  220  -49  -19  -30  -42  -12  33  -20  107  -10  ]
  field MFFloat sad_08 [339  220  55  -19  -34  514  220  -53  -19  -34  -43  -8  33  -20  107  -4  ]
  field MFFloat sad_09 [339  220  60  -19  -39  514  220  -58  -19  -39  -44  -3  33  -20  107  1  ]
  field MFFloat sad_10 [339  220  65  -19  -44  514  220  -62  -19  -44  -45  1  33  -20  107  6  ]
  ##Fear
  field MFFloat fear_01 [339  220  22  -19  -1  514  220  -22  -19  -1  -36  -38  33  -20  107  -41 ] 
  field MFFloat fear_02 [340  218  27  -17  -2  513  219  -26  -18  -3  -33  -36  33  -20  107  -36 ] 
  field MFFloat fear_03 [340  216  32  -15  -3  513  218  -31  -16  -4  -29  -35  33  -20  107  -30 ] 
  field MFFloat fear_04 [341  214  36  -14  -4  512  216  -35  -15  -6  -26  -33  33  -20  107  -25 ] 
  field MFFloat fear_05 [341  212  41  -12  -5  511  215  -40  -14  -8  -22  -31  33  -20  107  -20 ] 
  field MFFloat fear_06 [342  209  46  -10  -7  511  214  -44  -12  -9  -19  -30  33  -20  107  -14 ] 
  field MFFloat fear_07 [342  207  51  -8  -8  510  213  -49  -11  -11  -15  -28  33  -20  107  -9 ] 
  field MFFloat fear_08 [343  205  55  -7  -9  509  211  -53  -10  -13  -12  -26  33  -20  107  -4 ] 
  field MFFloat fear_09 [343  203  60  -5  -10  509  210  -58  -8  -14  -8  -25  33  -20  107  2 ] 
  field MFFloat fear_10 [344  201  65  -3  -11  508  209  -62  -7  -16  -5  -23  33  -20  107  7 ] 
  ##Surprise
  field MFFloat surprise_01 [339  220  22  -19  -1  514  220  -22  -19  -1  -36  -38  33  -20  107  -41 ] 
  field MFFloat surprise_02 [339  218  22  -22  -5  514  218  -22  -22  -5  -31  -37  33  -20  101  -39  ]
  field MFFloat surprise_03 [339  216  22  -26  -9  514  216  -22  -26  -10  -25  -36  33  -20  96  -37  ]
  field MFFloat surprise_04 [339  214  22  -29  -13  514  214  -22  -29  -14  -20  -35  33  -21  90  -35  ]
  field MFFloat surprise_05 [339  212  22  -33  -17  514  212  -22  -33  -19  -15  -34  33  -21  85  -33  ]
  field MFFloat surprise_06 [339  209  22  -36  -22  514  209  -21  -36  -23  -9  -33  33  -21  79  -30  ]
  field MFFloat surprise_07 [339  207  22  -40  -26  514  207  -21  -40  -28  -4  -32  33  -21  74  -28  ]
  field MFFloat surprise_08 [339  205  22  -43  -30  514  205  -21  -43  -32  1  -31  33  -22  68  -26  ]
  field MFFloat surprise_09 [339  203  22  -47  -34  514  203  -21  -47  -37  7  -30  33  -22  63  -24  ]
  field MFFloat surprise_10 [339  201  22  -50  -38  514  201  -21  -50  -41  12  -29  33  -22  57  -22  ]
  
  

additional fields


  
              field    MFFloat temp    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
              eventOut MFFloat setFrame
              eventIn  MFFloat set_emotion 
              eventIn  SFFloat set_fraction
              url "vrmlscript:
                  function initialize() {
                      setFrame = neutral;
                  }
  
  

emotion interpolation


                  function interpolateEmotions(strength,fraction,e1,e2,e3,e4) {
                      i = 0;
                      for(i=0;i<16;i++) {
                          a = e1[i] + (e2[i]-e1[i])*fraction;
                          b = e3[i] + (e4[i]-e3[i])*fraction;
                          temp[i] = a + (b-a)*strength;
                      }
                      setFrame = temp;
                  }
  

joy


                  function getJoy(strength) {
                      if(strength > 9)      return joy_10;
                      else if(strength > 8) return joy_09;
                      else if(strength > 7) return joy_08;
                      else if(strength > 6) return joy_07;
                      else if(strength > 5) return joy_06;
                      else if(strength > 4) return joy_05;
                      else if(strength > 3) return joy_04;
                      else if(strength > 2) return joy_03;
                      else if(strength > 1) return joy_02;
                      else                  return joy_01;
                  }
  

disgust


                  function getDisgust(strength) {
                      if(strength > 9)      return disgust_10;
                      else if(strength > 8) return disgust_09;
                      else if(strength > 7) return disgust_08;
                      else if(strength > 6) return disgust_07;
                      else if(strength > 5) return disgust_06;
                      else if(strength > 4) return disgust_05;
                      else if(strength > 3) return disgust_04;
                      else if(strength > 2) return disgust_03;
                      else if(strength > 1) return disgust_02;
                      else                  return disgust_01;
                  }
  

anger


                  function getAnger(strength) {
                      if(strength > 9)      return anger_10;
                      else if(strength > 8) return anger_09;
                      else if(strength > 7) return anger_08;
                      else if(strength > 6) return anger_07;
                      else if(strength > 5) return anger_06;
                      else if(strength > 4) return anger_05;
                      else if(strength > 3) return anger_04;
                      else if(strength > 2) return anger_03;
                      else if(strength > 1) return anger_02;
                      else                  return anger_01;
                  }
  

sad


                  function getSad(strength) {
                      if(strength > 9)      return sad_10;
                      else if(strength > 8) return sad_09;
                      else if(strength > 7) return sad_08;
                      else if(strength > 6) return sad_07;
                      else if(strength > 5) return sad_06;
                      else if(strength > 4) return sad_05;
                      else if(strength > 3) return sad_04;
                      else if(strength > 2) return sad_03;
                      else if(strength > 1) return sad_02;
                      else                  return sad_01;
                  }
  

fear


                  function getFear(strength) {
                      if(strength > 9)      return fear_10;
                      else if(strength > 8) return fear_09;
                      else if(strength > 7) return fear_08;
                      else if(strength > 6) return fear_07;
                      else if(strength > 5) return fear_06;
                      else if(strength > 4) return fear_05;
                      else if(strength > 3) return fear_04;
                      else if(strength > 2) return fear_03;
                      else if(strength > 1) return fear_02;
                      else                  return fear_01;
                  }
  

surprise


                  function getSurprise(strength) {
                      if(strength > 9)      return surprise_10;
                      else if(strength > 8) return surprise_09;
                      else if(strength > 7) return surprise_08;
                      else if(strength > 6) return surprise_07;
                      else if(strength > 5) return surprise_06;
                      else if(strength > 4) return surprise_05;
                      else if(strength > 3) return surprise_04;
                      else if(strength > 2) return surprise_03;
                      else if(strength > 1) return surprise_02;
                      else                  return surprise_01;
                  }
  

get/set emotions


  
                  function getEmotion(strength,fraction) {
                      if (fraction > 5)      return getJoy(strength);
                      else if (fraction > 4) return getDisgust(strength);
                      else if (fraction > 3) return getAnger(strength);
                      else if (fraction > 2) return getSad(strength);
                      else if (fraction > 1) return getFear(strength);
                      else return getSurprise(strength);
                  }
                  function set_emotion(value,time) {
                      // 0 <= value[0] < 2 PI
                      // 0 <= value[1] < 1
                      fraction = (value[0] / (2*Math.PI)) * 6;
                      strength = value[1] * 10;
  //Browser.print('set_emotion '+fraction+'   strength '+strength);
                      
                      if (strength < 0.5) {
                          setFrame = neutral;
                      }
                      f1 = fraction;     if(f1<0)  f1 += 6;
                      f2 = fraction + 1; if(f2>6)  f2 -= 6;
                      em1 = getEmotion(strength  ,f1);
                      em2 = getEmotion(strength  ,f2);
                      em3 = getEmotion(strength+1,f1);
                      em4 = getEmotion(strength+1,f2);
                      while(strength>1) strength -= 1;
                      while(fraction>1) fraction -= 1;
  //Browser.print('f1 '+f1+'   f2 '+f2+'  fraction '+fraction);
                      interpolateEmotions(strength,fraction,em1,em2,em3,em4);
                      
                  }
              "
          }
  
      ]
  }
  
  

HUD


  
  HUD { children SwingingArm { translation 2 0.5 -2 children  [
          Transform {
              scale 0.2 0.2 0.2
              children [
                  Shape {
                      appearance Appearance { 
                          material Material {transparency 0.5 }
                          texture ImageTexture { url "disc.gif"  }
                      }
                      geometry IndexedFaceSet {
                          solid FALSE
                          coord Coordinate { point [ -1.0  -1.0  0.0,
                                                      1.0  -1.0  0.0,
                                                      1.0   1.0  0.0,
                                                     -1.0   1.0  0.0] }
                          texCoord TextureCoordinate { point [ 0 1,
                                                               1 1,
                                                               1 0,
                                                               0 0 ] }
                          coordIndex    [ 0, 1, 2, 3, -1]
                          texCoordIndex [ 3, 2, 1, 0, -1]
                      }
                  }
                  Group { children [
                  DEF CONTROL_TRANS Transform {
                      translation 0 0 0
                      children DEF CONTROL Sphere { radius 0.1 }
                  }
                  DEF DRAGSENSOR PlaneSensor {
                      minPosition -1 -1 
                      maxPosition  1  1
                  }
                  ] }
              ]
          }
  

interface script


          DEF DISC_INTERFACE Script {
              eventIn  SFVec3f set_translation
              field    MFFloat temp [0 0]
              eventOut MFFloat set_emotion
              url "vrmlscript:
                  function set_translation(value,time) {
                      x = value[0];
                      y = value[1];
                      clickRadius = Math.sqrt(x*x+y*y);
                      if(clickRadius >= 1) clickRadius = 0.999;
                      clickAngle  = Math.atan(x/y);
                      if(y>0)      clickAngle += Math.PI;
                      else if(x>0) clickAngle += 2*Math.PI;
  // Turn the wheel a bit...
                      clickAngle += 5 *(Math.PI/6);
                      if(clickAngle>(2*Math.PI)) clickAngle -= (2*Math.PI);
  //                  Browser.print('Angle '+clickAngle+ ' Radius '+clickRadius); 
                      temp[0] = clickAngle;
                      temp[1] = clickRadius;
                      set_emotion = temp;
                  }
              "
          }
  

routing from disc


          ROUTE DRAGSENSOR.translation_changed TO CONTROL_TRANS.translation
          ROUTE DRAGSENSOR.translation_changed TO DISC_INTERFACE.set_translation
          ROUTE DISC_INTERFACE.set_emotion     TO INTERPOLATOR.set_emotion
          ROUTE INTERPOLATOR.setFrame          TO MOON_ANIM.setFrame
  ] } }
  
  

avatar scene


  
  
  
  
  # file            : hanimlegoavatar.wrl
  # description     : lego-look avatar instance.
  # author          : R.E. Blom
  # created         : 20-01-2000
  # modified        : 24-01-2000
  # remarks         : hanimlegoskincolor, hanimlegoupperbodycolor and hanimlegolowerbodycolor can be redefined, e.g.:
  #                     #@define hanimlegoskincolor 1 1 1
  #                   before #@including hanimlegoavatarproto.wrl
  ##
  
  #
  # include first part of lego-look avatar prototype.
  #
  
  
  

from lego


  ##
  # file            : hanimlegoavatarproto.wrl
  # description     : lego-look avatar prototype.
  # author          : R.E. Blom
  # created         : 20-01-2000
  # modified        : 28-01-2000
  # remarks         : hanimlegoavatarproto.wrl declares an Avatar proto according to the specifications
  #                   by Blaxxun.
  #                   The actual avatar geometry and animations are not hardcoded in this file, but
  #                   are #@included from separate files.
  #                   The following timers are DEFed in hanimlegoavatarproto.wrl and can be used to
  #                   trigger #@included animations:
  #                     TimeMove    : triggered when the avatar moves, this timer is used to move
  #                                   the avatar whenever it is not viewed in 3rd person mode or
  #                                   is viewed in another browser than that of the owner of the avatar.
  #                                   It is generally not necessary to use this timer to trigger
  #                                   animations, use TimeWalk instead.
  #                     TimeStop    : triggered when the avatar stops moving, this timer is currently
  #                                   used to reset the avatar to its neutral position.
  #                     TimeWalk    : triggered when the avatar moves, this timer can be used to
  #                                   run a walk animation while the avatar is moving.
  #                     TimeGesture1: triggered when the avatar receives a gesture1 event.
  #                     TimeGesture2: triggered when the avatar receives a gesture2 event.
  #                     TimeGesture3: triggered when the avatar receives a gesture3 event.
  #                     TimeGesture4: triggered when the avatar receives a gesture4 event.
  #                     TimeGesture5: triggered when the avatar receives a gesture5 event.
  #                     TimeGesture6: triggered when the avatar receives a gesture6 event.
  #                     TimeGesture7: triggered when the avatar receives a gesture7 event.
  #                     TimeGesture8: triggered when the avatar receives a gesture8 event.
  #                   The cycleinterval of each timer can be set by defining timegesture1cycleinterval
  #                   through timegesture8cycleinterval respectively.
  ##
  
  

proto joint


  
  PROTO Joint [
    exposedField  SFVec3f     center            0 0 0
    exposedField  MFNode      children          []
    exposedField  MFFloat     llimit            []
    exposedField  SFRotation  limitOrientation  0 0 1 0
    exposedField  SFString    name              ""
    exposedField  SFRotation  rotation          0 0 1 0
    exposedField  SFVec3f     scale             1 1 1
    exposedField  SFRotation  scaleOrientation  0 0 1 0
    exposedField  MFFloat     stiffness         [0 0 0]
    exposedField  SFVec3f     translation       0 0 0
    exposedField  MFFloat     ulimit            []
  ]
  {
    Transform {
      center           IS center
      children         IS children
      rotation         IS rotation
      scale            IS scale
      scaleOrientation IS scaleOrientation
      translation      IS translation
    }
  }
  
  

proto segment


  
  PROTO Segment [
    field         SFVec3f   bboxCenter        0 0 0
    field         SFVec3f   bboxSize          -1 -1 -1
    exposedField  SFVec3f   centerOfMass      0 0 0
    exposedField  MFNode    children          []
    exposedField  SFNode    coord             NULL
    exposedField  MFNode    displacers        []
    exposedField  SFFloat   mass              0 
    exposedField  MFFloat   momentsOfInertia  [0 0 0 0 0 0 0 0 0]
    exposedField  SFString  name              ""
    eventIn       MFNode    addChildren
    eventIn       MFNode    removeChildren
  ]
  {
    Group {
      addChildren    IS addChildren
      bboxCenter     IS bboxCenter
      bboxSize       IS bboxSize
      children       IS children
      removeChildren IS removeChildren
    }
  }
  
  

proto humanoid


  
  PROTO Humanoid [
    field         SFVec3f     bboxCenter        0 0 0
    field         SFVec3f     bboxSize          -1 -1 -1
    exposedField  SFVec3f     center            0 0 0
    exposedField  MFNode      humanoidBody      []
    exposedField  MFString    info              []
    exposedField  MFNode      joints            []
    exposedField  SFString    name              ""
    exposedField  SFRotation  rotation          0 0 1 0
    exposedField  SFVec3f     scale             1 1 1
    exposedField  SFRotation  scaleOrientation  0 0 1 0
    exposedField  MFNode      segments          []
    exposedField  MFNode      sites             []
    exposedField  SFVec3f     translation       0 0 0
    exposedField  SFString    version           "1.1"
    exposedField  MFNode      viewpoints        []
  ]
  {
    Transform {
      bboxCenter       IS bboxCenter
      bboxSize         IS bboxSize
      center           IS center
      rotation         IS rotation
      scale            IS scale
      scaleOrientation IS scaleOrientation
      translation      IS translation
      children [
        Group {
          children IS viewpoints
        }
        Group {
          children IS humanoidBody 
        }
      ]
    }
  }
  
  

proto avatar


  
  PROTO Avatar [
    exposedField  SFString    nickname     ""
    exposedField  SFTime      gesture1     0
    exposedField  SFTime      gesture2     0
    exposedField  SFTime      gesture3     0
    exposedField  SFTime      gesture4     0
    exposedField  SFTime      gesture5     0
    exposedField  SFTime      gesture6     0
    exposedField  SFTime      gesture7     0
    exposedField  SFTime      gesture8     0
    exposedField  SFBool      isAvatar     TRUE 
    exposedField  SFBool      isPilot      FALSE
    exposedField  SFBool      isOver       FALSE
    exposedField  SFInt32     whichChoice  0
    exposedField  SFTime      touchTime    0
    exposedField  SFRotation  rotation     0 1 0 0
    exposedField  SFVec3f     position     0 0 0
    exposedField  MFString    gestureNames ["Hallo","Hey","Agree","Like","Dislike","Disagree","Not now","Good bye","Appear","Disappear"]
  ]
  
  

avatar proto body


  {
    Switch { 
      whichChoice IS whichChoice
      choice [
        DEF AnimatedAvatar Transform {
          rotation    IS rotation
          children [
  
            Transform {
              translation 0 -1.61 0    #the origin point of the hanim lego humanoid is between the feet,
                                       #but it should be in the head.
              children [
  
  

humanoid


  DEF Humanoid Humanoid {
    humanoidBody [
      DEF hanim_HumanoidRoot Joint {
  #
  # lichaam
  #
        name "HumanoidRoot"
        translation 0 0 0
        rotation 0 0 1 0
        center 0 0.739897 -0.0278441
        children [
          DEF hanim_sacroiliac Joint {
  #
  # lichaam / heupgewricht
  #
            name "sacroiliac"
            rotation 0 0 1 0
            center 0 0.739897 -0.0278441
            children [
              DEF hanim_pelvis Segment {
  #
  # lichaam / heupgewricht / [bekken]
  #
                name "pelvis"
              }
              DEF hanim_l_hip Joint {
  #
  # lichaam / heupgewricht / linkerheup
  #
                name "l_hip"
                rotation 0 0 1 0
                center 0.122 0.6391 -0.0323
                children [
                  DEF hanim_l_thigh Segment {
  #
  # lichaam / heupgewricht / linkerheup / [linkerbovenbeen]
  #
                    name "l_thigh"
                    children [
                      Transform {
                        translation 0.165 0.639138 -0.032316
                        rotation  0 0 1  4.71219
                        scale 0.3 0.3 0.3
                        children Shape {
                          appearance  Appearance {
                            material DEF legolowerbodymaterial Material {
                              ambientIntensity  0.2
                              shininess 0.2
                              diffuseColor 0.4 0.4 0.8
                            }
                          }
  
                          geometry  Cylinder {
                            height  1
                            radius  0.5
                          }
  
                        }
                      }
                      Transform {
                        translation 0.165 0.495 -0.0605001
                        children Shape {
                          appearance  Appearance {
                            material USE legolowerbodymaterial
                          }
  
                          geometry  Box {
                            size  0.3 0.3 0.21
                          }
  
                        }
                      }
                    ]
                  }
                  DEF hanim_l_knee Joint {
  #
  # lichaam / heupgewricht / linkerheup / linkerknie
  #
                    name "l_knee"
                    rotation 0 0 1 0
                    center 0.0738 0.345 -0.0595
                    children [ 
                      DEF hanim_l_calf Segment {
  #
  # lichaam / heupgewricht / linkerheup / linkerknie / [linkeronderbeen]
  #
  # (bevat ook linkervoet)
  #
                        name "l_calf"
                        children [
                          Transform {
                            translation 0.165 0.345 -0.0605
                            rotation  0 0 1  1.5708
                            children Shape {
                              appearance  Appearance {
                                material USE legolowerbodymaterial
                              }
  
                              geometry  Cylinder {
                                height  0.3
                                radius  0.105
                              }
  
                            }
                          }
                          Transform {
                            translation 0.165 0.2775 -0.0605
                            children Shape {
                              appearance  Appearance {
                                material USE legolowerbodymaterial
                              }
  
                              geometry  Box {
                                size  0.3 0.135 0.21
                              }
  
                            }
                          }
                          Transform {
                            translation 0.165 0.105 -0.0155
                            children Shape {
                              appearance  Appearance {
                                material USE legolowerbodymaterial
                              }
  
                              geometry  Box {
                                size  0.3 0.21 0.3
                              }
  
                            }
                          }
                        ]
                      }
                      DEF hanim_l_ankle Joint {
  #
  # lichaam / heupgewricht / linkerheup / linkerknie / linkerenkel
  #
                        name "l_ankle"
                        rotation 0 0 1 0
                        center 0.0645 0.0719 -0.048
                        children DEF hanim_l_hindfoot Segment {
  #
  # lichaam / heupgewricht / linkerheup / linkerknie / linkerenkel / [linkervoet]
  #
  # (linkervoet zit in lichaam / heupgewricht / linkerheup / linkerknie / [linkeronderbeen])
  #
                          name "l_hindfoot"
                        }
                      }
                    ]
                  }
                ]
              }
              DEF hanim_r_hip Joint {
  #
  # lichaam / heupgewricht / rechterheup
  #
                name "r_hip"
                rotation 0 0 1 0
                center -0.122 0.6391 -0.0323
                children [
                  DEF hanim_r_thigh Segment {
  #
  # lichaam / heupgewricht / rechterheup / [rechterbovenbeen]
  #
                    name "r_thigh"
                    children [
                      Transform {
                        translation -0.165 0.639138 -0.032316
                        rotation  0 0 1  4.71219
                        scale 0.3 0.3 0.3
                        children Shape {
                          appearance  Appearance {
                            material USE legolowerbodymaterial
                          }
  
                          geometry  Cylinder {
                            height  1
                            radius  0.5
                          }
  
                        }
                      }
                      Transform {
                        translation -0.165 0.495 -0.0605001
                        children Shape {
                          appearance  Appearance {
                            material USE legolowerbodymaterial
                          }
  
                          geometry  Box {
                            size  0.3 0.3 0.21
                          }
  
                        }
                      }
                    ]
                  }
                  DEF hanim_r_knee Joint {
  #
  # lichaam / heupgewricht / rechterheup / rechterknie
  #
                    name "r_knee"
                    rotation 0 0 1 0
                    center -0.0738 0.345 -0.0595
                    children [
                      DEF hanim_r_calf Segment {
  #
  # lichaam / heupgewricht / rechterheup / rechterknie / [rechteronderbeen]
  #
  # (bevat ook rechtervoet)
  #
                        name "r_calf"
                        children [
                          Transform {
                            translation -0.165 0.345 -0.0605
                            rotation  0 0 1  1.5708
                            children Shape {
                              appearance  Appearance {
                                material USE legolowerbodymaterial
                              }
  
                              geometry  Cylinder {
                                height  0.3
                                radius  0.105
                              }
  
                            }
                          }
                          Transform {
                            translation -0.165 0.2775 -0.0605
                            children Shape {
                              appearance  Appearance {
                                material USE legolowerbodymaterial
                              }
  
                              geometry  Box {
                                size  0.3 0.135 0.21
                              }
  
                            }
                          }
                          Transform {
                            translation -0.165 0.105 -0.0155
                            children Shape {
                              appearance  Appearance {
                                material USE legolowerbodymaterial
                              }
  
                              geometry  Transform {

                            translation -0.165 0.105 -0.0155

                            children Shape {

                              appearance  Appearance {

                                material USE legolowerë‘|§2|×.html>Box {
                                size  0.3 0.21 0.3
                              }
  
                            }
                          }
                        ]
                      }
                      DEF hanim_r_ankle Joint {
  #
  # lichaam / heupgewricht / rechterheup / rechterknie / rechterenkel
  #
                        name "r_ankle"
                        rotation 0 0 1 0
                        center -0.064 0.0753 -0.0412
                        children DEF hanim_r_hindfoot Segment {
  #
  # lichaam / heupgewricht / rechterheup / rechterknie / rectherenkel / [ rechtervoet]
  #
  # (rechtervoet zit in lichaam / heupgewricht / rechterheup / rechterknie / [rechteronderbeen])
  #
                          name "r_hindfoot"
                        }
                      }
                    ]
                  }
                ]
              }
            ]
          }
          DEF hanim_vl1 Joint {
  #
  # lichaam / schouder+nekgewrichten
  #
            name "vl1"
            rotation 0 0 1 0
            center 0 0.739897 -0.0278441
            children [
              DEF hanim_c7 Segment {
  #
  # lichaam / schouder+nekgewrichten / [romp]
  #
                name "l1"
                children [
                  Transform {
                    translation 0 0.739897 -0.0278441
                    scale 0.3 0.3 0.3
                    children Shape {
                      appearance  Appearance {
                        material USE legolowerbodymaterial
                      }
                      geometry  Box {
                        size  2 0.5 1
                      }
                    }
                  }
                  Transform {
                    translation 0.891356 1.40461 -0.181111
                    rotation  1 0 0  1.571
                    scale 0.3 0.3 0.3
                    children Shape {
                      appearance  Appearance {
                        material DEF legoupperbodymaterial Material {
                          ambientIntensity  0.2
                          shininess 0.2
                          diffuseColor 0.4 0.4 0.8
                        }
  
                      }
  
                      geometry  IndexedFaceSet {
                        coord Coordinate {
                          point [ -2.4 0 0,
                                -3.6 0 0,
                                -3.57396 1 0,
                                -2.3432 1 0,
                                -4 0 2,
                                -3.95266 1 1.9645,
                                -2 0 2,
                                -1.98817 1 1.9645 ]
                        }
  
                        ccw TRUE
                        convex  FALSE
                        creaseAngle 0.524
                        solid TRUE
                        coordIndex  [ 0, 1, 2, 3, -1, 1, 4, 5,
                              -1, 1, 5, 2, -1, 4, 6, 7,
                              5, -1, 6, 0, 3, -1, 6, 3,
                              7, -1, 3, 2, 5, 7, -1, 6,
                              4, 1, 0, -1 ]
                      }
  
                    }
                  }
                ]
              }
              DEF hanim_l_shoulder Joint {
  #
  # lichaam / schouder+nekgewrichten / linkerschouder
  #
                name "l_shoulder"
                rotation 0 0 1 0
                center 0.167 1.36 -0.0518
                children [
                  DEF hanim_l_upperarm Segment {
  #
  # lichaam / schouder+nekgewrichten / linkerschouder / [linkerbovenarm]
  #
                    name "l_upperarm"
                    children [
                      Transform {
                        translation 0.233393 1.31418 -0.032316
                        scale 0.3 0.3 0.3
                        children Shape {
                          appearance  Appearance {
                            material USE legoupperbodymaterial
                          }
  
                          geometry  Sphere {
                            radius  0.3
                          }
  
                        }
                      }
                      Transform {
                        translation 0.345587 1.1677 -0.0292196
                        rotation  0.302885 -0.887656 0.346883  1.649
                        scale 0.3 0.3 0.3
                        scaleOrientation  -0.316531 0.948385 0.0193552  0.873316
                        children Shape {
                          appearance  Appearance {
                            material USE legoupperbodymaterial
                          }
  
                          geometry  Cylinder {
                            height  1.2
                            radius  0.3
                          }
  
                        }
                      }
                    ]
                  }
                  DEF hanim_l_elbow Joint {
  #
  # lichaam / schouder+nekgewrichten / linkerschouder / linkerelleboog
  #
                    name "l_elbow"
                    rotation 0 0 1 0
                    center 0.416 1.0323 -0.0251
                    children [
                      DEF hanim_l_forearm Segment {
  #
  # lichaam / schouder+nekgewrichten / linkerschouder / linkerelleboog / [linkeronderarm]
  #
  # (bevat ook linkerhand)
  #
                        name "l_forearm"
                        children [
                          Transform {
                            translation 0.461009 1.03228 -0.0251
                            scale 0.3 0.3 0.3
                            children Shape {
                              appearance  Appearance {
                                material USE legoupperbodymaterial
                              }
  
                              geometry  Sphere {
                                radius  0.3
                              }
  
                            }
                          }
                          Transform {
                            translation 0.498894 0.885476 0.0303936
                            rotation  -0.831779 0.124967 0.540857  0.432
                            scale 0.3 0.3 0.3
                            scaleOrientation  0.998137 -0.0577765 0.0196204  3.92609
                            children Shape {
                              appearance  Appearance {
                                material USE legoupperbodymaterial
                              }
  
                              geometry  Cylinder {
                                height  1
                                radius  0.3
                              }
  
                            }
                          }
                          Transform {
                            translation 0.238132 0.63154 0.00206059
                            rotation  0.589657 -0.696072 -0.40962  1.76734
                            scale 0.21 0.21 0.21
                            scaleOrientation  -0.0246322 0.999604 -0.0136335  3.14073
                            children Shape {
                              appearance  Appearance {
                                material  DEF legoskinmaterial Material {
                                  ambientIntensity  0.2
                                  shininess 0.2
                                  diffuseColor  0.4 0.4 0.8
                                }
  
                              }
  
                              geometry  Extrusion {
                                beginCap  TRUE
                                endCap  TRUE
                                ccw TRUE
                                convex  FALSE
                                creaseAngle 0.524
                                solid TRUE
                                crossSection  [ 1 -1.8,
                                      0.8 -2,
                                      0.2 -2,
                                      0 -1.8,
                                      0 -1.2,
                                      0.2 -1,
                                      0.8 -1,
                                      1 -1.2,
                                      0.2 -1.2,
                                      0.2 -1.8,
                                      1 -1.8 ]
                                orientation [ 0 0 1  0,
                                      0 0 1  0 ]
                                scale [ 1 1,
                                      1 1 ]
                                spine [ 0 0 0,
                                      0 0.8 0 ]
                              }
  
                            }
                          }
                        ]
                      }
                      DEF hanim_l_wrist Joint {
  #
  # lichaam / schouder+nekgewrichten / linkerschouder / linkerelleboog / linkerpols
  #
                        name "l_wrist"
                        rotation 0 0 1 0
                        center 0.213 0.811 -0.0338
                        children DEF hanim_l_hand Segment {
  #
  # lichaam / schouder+nekgewrichten / linkerschouder / linkerelleboog / linkerpols / [linkerhand]
  #
  # (linkerhand zit in lichaam / schouder+nekgewrichten / linkerschouder / linkerelleboog / [linkeronderarm])
  #
                          name "l_hand"
                        }
                      }
                    ]
                  }
                ]
              }
              DEF hanim_r_shoulder Joint {
  #
  # lichaam / schouder+nekgewrichten / rechterschouder
  #
                name "r_shoulder"
                rotation 0 0 1 0
                center -0.167 1.36 -0.0518
                children [
                  DEF hanim_r_upperarm Segment {
  #
  # lichaam / schouder+nekgewrichten / rechterschouder / [rechterbovenarm]
  #
                    name "r_upperarm"
                    children [
                      Transform {
                        translation -0.233393 1.31418 -0.032316
                        scale 0.3 0.3 0.3
                        children Shape {
                          appearance  Appearance {
                            material USE legoupperbodymaterial
                          }
  
                          geometry  Sphere {
                            radius  0.3
                          }
  
                        }
                      }
                      Transform {
                        translation -0.345587 1.1677 -0.0292195
                        rotation  0.302885 0.887656 -0.346883  1.649
                        scale 0.3 0.3 0.3
                        scaleOrientation  -0.625232 0.109229 -0.772757  0.526493
                        children Shape {
                          appearance  Appearance {
                            material USE legoupperbodymaterial
                          }
  
                          geometry  Cylinder {
                            height  1.2
                            radius  0.3
                          }
  
                        }
                      }
                    ]
                  }
                  DEF hanim_r_elbow Joint {
  #
  # lichaam / schouder+nekgewrichten / rechterschouder / rechterelleboog
  #
                    name "r_elbow"
                    rotation 0 0 1 0
                    center -0.416 1.0323 -0.0251
                    children [
                      DEF hanim_r_forearm Segment {
  #
  # lichaam / schouder+nekgewrichten / rechterschouder / rechterelleboog / [rechteronderarm]
  #
  # (bevat ook rechterhand)
  #
                        name "r_forearm"
                        children [
                          Transform {
                            translation -0.461009 1.03228 -0.0251
                            scale 0.3 0.3 0.3
                            children Shape {
                              appearance  Appearance {
                                material USE legoupperbodymaterial
                              }
  
                              geometry  Sphere {
                                radius  0.3
                              }
  
                            }
                          }
                          Transform {
                            translation -0.498894 0.885476 0.0303936
                            rotation  -0.831779 0.124967 -0.540857  0.432
                            scale 0.3 0.3 0.3
                            scaleOrientation  0.333191 0.145916 0.9315  0.252315
                            children Shape {
                              appearance  Appearance {
                                material USE legoupperbodymaterial
                              }
  
                              geometry  Cylinder {
                                height  1
                                radius  0.3
                              }
  
                            }
                          }
                          Transform {
                            translation -0.223698 0.680385 0.152508
                            rotation  0.551711 -0.515997 0.655257  3.73194
                            scale 0.21 0.21 0.21
                            scaleOrientation  -0.449335 -0.428707 -0.783778  1.11741
                            children Shape {
                              appearance  Appearance {
                                material  USE legoskinmaterial
                              }
  
                              geometry  Extrusion {
                                beginCap  TRUE
                                endCap  TRUE
                                ccw TRUE
                                convex  FALSE
                                creaseAngle 0.524
                                solid TRUE
                                crossSection  [ 1 -1.8,
                                      0.8 -2,
                                      0.2 -2,
                                      0 -1.8,
                                      0 -1.2,
                                      0.2 -1,
                                      0.8 -1,
                                      1 -1.2,
                                      0.2 -1.2,
                                      0.2 -1.8,
                                      1 -1.8 ]
                                orientation [ 0 0 1  0,
                                      0 0 1  0 ]
                                scale [ 1 1,
                                      1 1 ]
                                spine [ 0 0 0,
                                      0 0.8 0 ]
                              }
  
                            }
                          }
                        ]
                      }
                      DEF hanim_r_wrist Joint {
  #
  # lichaam / schouder+nekgewrichten / rechterschouder / rechterelleboog / rechterpols
  #
                        name "r_wrist"
                        rotation 0 0 1 0
                        center -0.213 0.811 -0.0338
                        children DEF hanim_r_hand Segment {
  #
  # lichaam / schouder+nekgewrichten / rechterschouder / rechterelleboog / rechterpols / [rechterhand]
  #
  # (rechterhand zit in lichaam / schouder+nekgewrichten / rechterschouder / rechterelleboog / [rechteronderarm])
  #
                          name "r_hand"
                        }
                      }
                    ]
                  }
                ]
              }
              DEF hanim_vc4 Joint {
  #
  # lichaam / schouder+nekgewrichten / nekgewricht
  #
                name "vc4"
                rotation 0 0 1 0
                center 0 1.43 -0.0458
                children [
                  DEF hanim_c4 Segment {
  #
  # lichaam / schouder+nekgewrichten / nekgewricht / [nek]
  #
                    name "c4"
                    children Transform {
                      translation 0 1.43435 -0.0251345
                      children Shape {
                        appearance  Appearance {
                          material USE legoupperbodymaterial
                        }
  
                        geometry  Cylinder {
                          height  0.06
                          radius  0.12
                        }
                      }
                    }
                  }
                  DEF hanim_skullbase Joint {
  #
  # lichaam / schouder+nekgewrichten / nekgewricht / schedelbasis
  #
                    name "skullbase"
                    rotation 0 0 1 0
                    center 0 1.54 -0.0409
                    children DEF hanim_skull Segment {
  #
  # lichaam / schouder+nekgewrichten / nekgewricht / schedelbasis / [schedel]
  #
                      name "skull"
                      children [
                        Transform {
                          translation 0 1.79214 -0.0189532
                          scale 0.12 0.12 0.12
                          children Shape {
                            appearance  Appearance {
                              material USE legoskinmaterial
                            }
  
                            geometry  Cylinder {
                              height  0.6
                              radius  1
                            }
  
                          }
                        }
                        # place the Transform containing the texture last in the file,
                        # because Blaxxun Contact does not handle "USE legoskinmaterial"
                        # correctly after it is used in an Appearance which also
                        # defines a texture.
                        Transform {
                          translation 0 1.61061 -0.0215438
                          children Shape {
                            appearance  DEF LegoFaceAppearance Appearance {
                              material USE legoskinmaterial
  
                            }
  
                            geometry  Cylinder {
                              height  0.2928
                              radius  0.18
                            }
  
                          }
                        }
                      ]
                    }
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  
  

joints


  
    joints [
      USE hanim_HumanoidRoot,
      USE hanim_sacroiliac,
      USE hanim_l_hip,
      USE hanim_l_knee,
      USE hanim_l_ankle,
      USE hanim_r_hip,
      USE hanim_r_knee,
      USE hanim_r_ankle,
      USE hanim_vl1,
      USE hanim_vc4,
      USE hanim_skullbase
      USE hanim_l_shoulder,
      USE hanim_l_elbow,
      USE hanim_l_wrist,
      USE hanim_r_shoulder,
      USE hanim_r_elbow,
      USE hanim_r_wrist,
    ]
  

info


  
    info [
      "a lego-look humanoid constructed according to the specifications"
      "proposed by the Humanoid Animation Working Group"
    ]
    name "boxhumanoid"
  

segments


    segments [
      USE hanim_pelvis,
      USE hanim_l_thigh,
      USE hanim_l_calf,
      USE hanim_l_hindfoot,
      USE hanim_r_thigh,
      USE hanim_r_calf,
      USE hanim_r_hindfoot,
      USE hanim_c7,
      USE hanim_l_upperarm,
      USE hanim_l_forearm,
      USE hanim_l_hand,
      USE hanim_r_upperarm,
      USE hanim_r_forearm,
      USE hanim_r_hand,
      USE hanim_c4,
      USE hanim_skull
    ]
    version "1.1"
  }
  
              ]
            }
  
  

time sensor


            DEF TimeMove TimeSensor {
              cycleInterval 1
            }
            DEF TimeStop TimeSensor {
              cycleInterval 0.1
            }
            DEF TimeWalk TimeSensor {
              cycleInterval 1
            }
            DEF TimeGesture1 TimeSensor {
              startTime IS gesture1
              cycleInterval 1
            }
            DEF TimeGesture2 TimeSensor {
              startTime IS gesture2
              cycleInterval 1
            }
            DEF TimeGesture3 TimeSensor {
              startTime IS gesture3
              cycleInterval 1
            }
            DEF TimeGesture4 TimeSensor {
              startTime IS gesture4
              cycleInterval 1
            }
            DEF TimeGesture5 TimeSensor {
              startTime IS gesture5
              cycleInterval 1
            }
            DEF TimeGesture6 TimeSensor {
              startTime IS gesture6
              cycleInterval 1
            }
            DEF TimeGesture7 TimeSensor {
              startTime IS gesture7
              cycleInterval 1
            }
            DEF TimeGesture8 TimeSensor {
              startTime IS gesture8
              cycleInterval 1
            }
  
  ##
  # include animations here:
  #
  
  

animations


  
  #
  # include animations.
  #
  
  
  ##
  # file            : hanimanm_walk.wrl
  # description     : walk animation according to the Humanoid Animation Working Group humanoid standard.
  # author          : R.E. Blom
  # created         : 20-01-2000
  # modified        : 20-01-2000
  # remarks         : the animation is triggered by TimeWalk.
  #                   Adapted from "<a href=http://tecfa.unige.c>/vrml/objects/avatars/blaxxun/TEMPLATES/animation-templ.text"
  #                                 (Copyright (c) 1997 by blaxxun interactive Inc.)
  ##
  
  

the animations ...


  
  DEF Animations Group {
          children [ 
              DEF WalkAnimation Group {
                      children [ 
                          DEF r_shoulderRotWalk OrientationInterpolator {
                                  key        [ 0, 0.25, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  0.4,
                                                    0 0 1  0,
                                                    1 0 0  0.4,
                                                    0 0 1  0 ]
                          }
  
                          DEF r_hipRotWalk OrientationInterpolator {
                                  key        [ 0, 0.25, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    1 0 0  0.5,
                                                    0 0 1  0,
                                                    -1 0 0  0.5,
                                                    0 0 1  0 ]
                          }
  
                          DEF r_kneeRotWalk OrientationInterpolator {
                                  key        [ 0, 0.15, 0.25, 0.5,
                                                    0.75, 0.85, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 1  0,
                                                    1 0 0  0.6,
                                                    1 0 0  1,
                                                    0 0 1  0,
                                                    1 0 0  0.2,
                                                    0 0 1  0 ]
                          }
  
                          DEF r_elbowRotWalk OrientationInterpolator {
                                  key        [ 0, 0.25, 0.5, 1 ]
                                  keyValue        [ -1 0 0  0.4,
                                                    -1 0 0  1,
                                                    0 0 1  0,
                                                    0 0 1  0 ]
                          }
  
                          DEF l_shoulderRotWalk OrientationInterpolator {
                                  key        [ 0, 0.25, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    1 0 0  0.4,
                                                    0 0 1  0,
                                                    -1 0 0  0.4,
                                                    0 0 1  0 ]
                          }
  
                          DEF l_hipRotWalk OrientationInterpolator {
                                  key        [ 0, 0.25, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  0.5,
                                                    0 0 1  0,
                                                    1 0 0  0.5,
                                                    0 0 1  0 ]
                          }
  
                          DEF l_kneeRotWalk OrientationInterpolator {
                                  key        [ 0, 0.25, 0.35, 0.5,
                                                    0.65, 0.75, 1 ]
                                  keyValue        [ 1 0 0  1,
                                                    0 0 1  0,
                                                    1 0 0  0.2,
                                                    0 0 1  0,
                                                    0 0 1  0,
                                                    1 0 0  0.6,
                                                    1 0 0  1 ]
                          }
  
                          DEF l_elbowRotWalk OrientationInterpolator {
                                  key        [ 0, 0.25, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 1  0,
                                                    -1 0 0  0.4,
                                                    -1 0 0  1,
                                                    0 0 1  0 ]
                          }
  
                          DEF vl5RotWalk OrientationInterpolator {
                                  key        [ 0, 0.25, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    1 0 0  0.0999996,
                                                    0 0 1  0,
                                                    1 0 0  0.0999996,
                                                    0 0 1  0 ]
                          }
  
                          DEF HumanoidRootTransWalk PositionInterpolator {
                                  key        [ 0, 0.25, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 0,
                                                    0 -0.05 0,
                                                    0 0 0,
                                                    0 -0.05 0,
                                                    0 0 0 ]
                          }
                      ]
              }
  
              DEF StopAnimation Group {
                      children [ 
                          DEF jointTransStop PositionInterpolator {
                                  key        [ 0, 1 ]
                                  keyValue        [ 0 0 0,
                                                    0 0 0 ]
                          }
  
                          DEF jointRotStop OrientationInterpolator {
                                  key        [ 0, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 1  0 ]
                          }
                      ]
              }
  
              DEF NoAnimation Group {
                      children [ 
                          DEF r_shoulderRotNo OrientationInterpolator {
                                  key        [ 0, 0.05, 0.95, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  0.7,
                                                    -1 0 0  0.7,
                                                    0 0 1  0 ]
                          }
  
                          DEF r_elbowRotNo OrientationInterpolator {
                                  key        [ 0, 0.05, 0.95, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  0.8,
                                                    -1 0 0  0.8,
                                                    0 0 1  0 ]
                          }
  
                          DEF r_wristRotNo OrientationInterpolator {
                                  key        [ 0, 0.1, 0.2, 0.3,
                                                    0.4, 0.5, 0.6, 0.7,
                                                    0.8, 0.9, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -0.707107 0 -0.707107  0.8,
                                                    -0.707107 0 0.707107  0.8,
                                                    -0.707107 0 -0.707107  0.8,
                                                    -0.707107 0 0.707107  0.8,
                                                    -0.707107 0 -0.707107  0.8,
                                                    -0.707107 0 0.707107  0.8,
                                                    -0.707107 0 -0.707107  0.8,
                                                    -0.707107 0 0.707107  0.8,
                                                    -0.707107 0 -0.707107  0.8,
                                                    0 0 1  0 ]
                          }
  
                          DEF skullbaseRotNo OrientationInterpolator {
                                  key        [ 0, 0.125, 0.25, 0.375,
                                                    0.5, 0.625, 0.75, 0.875,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 1 0  0.3,
                                                    0 0 1  0,
                                                    0 -1 0  0.3,
                                                    0 0 1  0,
                                                    0 1 0  0.3,
                                                    0 0 1  0,
                                                    0 -1 0  0.3,
                                                    0 0 1  0 ]
                          }
                      ]
              }
  
              DEF HiAnimation Group {
                      children [ 
                          DEF vl5RotHi OrientationInterpolator {
                                  key        [ 0, 0.25, 0.75, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  0.2,
                                                    -1 0 0  0.2,
                                                    0 0 1  0 ]
                          }
  
                          DEF l_shoulderRotHi OrientationInterpolator {
                                  key        [ 0, 0.2, 0.4, 0.6,
                                                    0.8, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  0.5,
                                                    -1 0 0  1,
                                                    -1 0 0  1,
                                                    -1 0 0  0.5,
                                                    0 0 1  0 ]
                          }
  
                          DEF l_elbowRotHi OrientationInterpolator {
                                  key        [ 0, 0.2, 0.4, 0.6,
                                                    0.8, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  0.8,
                                                    -1 0 0  1.8,
                                                    -1 0 0  1.8,
                                                    -1 0 0  0.8,
                                                    0 0 1  0 ]
                          }
  
                          DEF l_wristRotHi OrientationInterpolator {
                                  key        [ 0, 0.4, 0.45, 0.5,
                                                    0.55, 0.6, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 1  0,
                                                    0 0 1  0.8,
                                                    0 0 1  0,
                                                    0 0 -1  0.8,
                                                    0 0 1  0,
                                                    0 0 1  0 ]
                          }
                      ]
              }
  
              DEF HeyAnimation Group {
                      children [ 
                          DEF HumanoidRootTransHey PositionInterpolator {
                                  key        [ 0, 0.25, 0.4, 0.5,
                                                    0.6, 0.72, 1 ]
                                  keyValue        [ 0 0 0,
                                                    0 -0.26 0,
                                                    0 0.3 0,
                                                    0 0.5 0,
                                                    0 0.3 0,
                                                    0 -0.27 0,
                                                    0 0 0 ]
                          }
  
                          DEF HumanoidRootRotHey OrientationInterpolator {
                                  key        [ 0, 0.38, 0.47, 0.57,
                                                    0.66, 0.75, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 1  0,
                                                    -1 0 0  1.57,
                                                    -1 0 0  3.14,
                                                    -1 0 0  4.71,
                                                    0 0 1  0,
                                                    0 0 1  0 ]
                          }
  
                          DEF skullbaseRotHey OrientationInterpolator {
                                  key        [ 0, 0.25, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    1 0 0  0.3,
                                                    0 0 1  0,
                                                    1 0 0  0.3,
                                                    0 0 1  0 ]
                          }
  
                          DEF shoulderRotHey OrientationInterpolator {
                                  key        [ 0, 0.12, 0.25, 0.375,
                                                    0.7, 0.8, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    1 0 0  1,
                                                    0 0 1  0,
                                                    -1 0 0  0.8,
                                                    0 0 1  0,
                                                    -1 0 0  1.2,
                                                    0 0 1  0 ]
                          }
  
                          DEF elbowRotHey OrientationInterpolator {
                                  key        [ 0, 0.44, 0.5, 0.75,
                                                    1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 1  0,
                                                    -1 0 0  1.6,
                                                    -1 0 0  1.2,
                                                    0 0 1  0 ]
                          }
  
                          DEF hipRotHey OrientationInterpolator {
                                  key        [ 0, 0.25, 0.34, 0.37,
                                                    0.5, 0.65, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  1.3,
                                                    0 0 1  0,
                                                    0 0 1  0,
                                                    -1 0 0  2.5,
                                                    -1 0 0  1.5,
                                                    0 0 1  0 ]
                          }
  
                          DEF kneeRotHey OrientationInterpolator {
                                  key        [ 0, 0.25, 0.34, 0.37,
                                                    0.5, 0.81, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    1 0 0  2,
                                                    0 0 1  0,
                                                    0 0 1  0,
                                                    1 0 0  2.5,
                                                    1 0 0  1.6,
                                                    0 0 1  0 ]
                          }
  
                          DEF vl5RotHey OrientationInterpolator {
                                  key        [ 0, 0.12, 0.5, 0.64,
                                                    0.78, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    1 0 0  1.4,
                                                    0 0 1  0,
                                                    1 0 0  1.5,
                                                    1 0 0  1.6,
                                                    0 0 1  0 ]
                          }
                      ]
              }
  
              DEF YesAnimation Group {
                      children [ 
                          DEF l_elbowRotYes OrientationInterpolator {
                                  key        [ 0, 0.1, 0.9, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -0.707107 0 -0.707107  2.5,
                                                    -0.707107 0 -0.707107  2.5,
                                                    0 0 1  0 ]
                          }
  
                          DEF l_shoulderRotYes OrientationInterpolator {
                                  key        [ 0, 0.1, 0.9, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    -1 0 0  0.4,
                                                    -1 0 0  0.4,
                                                    0 0 1  0 ]
                          }
  
                          DEF vc4RotYes OrientationInterpolator {
                                  key        [ 0, 0.1, 0.9, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 -1  0.3,
                                                    0 0 -1  0.3,
                                                    0 0 1  0 ]
                          }
                      ]
              }
  
              DEF SmileAnimation Group {
                      children []
              }
  
              DEF FrownAnimation Group {
                      children [ 
                          DEF l_shoulderRotFrown OrientationInterpolator {
                                  key        [ 0, 0.1, 0.2, 0.8,
                                                    0.9, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 1  0.3,
                                                    0 0 1  0.6,
                                                    0 0 1  0.6,
                                                    0 0 1  0.3,
                                                    0 0 1  0 ]
                          }
  
                          DEF l_elbowRotFrown OrientationInterpolator {
                                  key        [ 0, 0.1, 0.2, 0.8,
                                                    0.9, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 -1  0.6,
                                                    0 0 -1  1.2,
                                                    0 0 -1  1.2,
                                                    0 0 -1  0.6,
                                                    0 0 1  0 ]
                          }
  
                          DEF r_shoulderRotFrown OrientationInterpolator {
                                  key        [ 0, 0.1, 0.2, 0.8,
                                                    0.9, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 -1  0.3,
                                                    0 0 -1  0.6,
                                                    0 0 -1  0.6,
                                                    0 0 -1  0.3,
                                                    0 0 1  0 ]
                          }
  
                          DEF r_elbowRotFrown OrientationInterpolator {
                                  key        [ 0, 0.1, 0.2, 0.8,
                                                    0.9, 1 ]
                                  keyValue        [ 0 0 1  0,
                                                    0 0 1  0.6,
                                                    0 0 1  1.2,
                                                    0 0 1  1.2,
                                                    0 0 1  0.6,
                                                    0 0 1  0 ]
                          }
                      ]
              }
  
              DEF NotAnimation Group {
                      children []
              }
  
              DEF ByeAnimation Group {
                      children DEF vl5RotBye OrientationInterpolator {
                              key        [ 0, 0.5, 1 ]
                              keyValue        [ 0 0 1  0,
                                                1 0 0  1.7,
                                                0 0 1  0 ]
                      }
              }
          ]
  }
  DEF Time_1 TimeSensor {
          loop        FALSE
  }
  
  

routing


  
  ROUTE TimeWalk.fraction_changed TO HumanoidRootTransWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO vl5RotWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO r_shoulderRotWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO r_elbowRotWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO r_hipRotWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO r_kneeRotWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO l_shoulderRotWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO l_elbowRotWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO l_hipRotWalk.set_fraction
  ROUTE TimeWalk.fraction_changed TO l_kneeRotWalk.set_fraction
  
  ROUTE HumanoidRootTransWalk.value_changed TO hanim_HumanoidRoot.set_translation
  ROUTE r_shoulderRotWalk.value_changed TO hanim_r_shoulder.set_rotation
  ROUTE r_elbowRotWalk.value_changed TO hanim_r_elbow.set_rotation
  ROUTE r_hipRotWalk.value_changed TO hanim_r_hip.set_rotation
  ROUTE r_kneeRotWalk.value_changed TO hanim_r_knee.set_rotation
  ROUTE l_shoulderRotWalk.value_changed TO hanim_l_shoulder.set_rotation
  ROUTE l_elbowRotWalk.value_changed TO hanim_l_elbow.set_rotation
  ROUTE l_hipRotWalk.value_changed TO hanim_l_hip.set_rotation
  ROUTE l_kneeRotWalk.value_changed TO hanim_l_knee.set_rotation
  ROUTE Time_1.fraction_changed TO vl5RotHi.set_fraction
  ROUTE Time_1.fraction_changed TO l_shoulderRotHi.set_fraction
  ROUTE Time_1.fraction_changed TO l_elbowRotHi.set_fraction
  ROUTE Time_1.fraction_changed TO l_wristRotHi.set_fraction
  ROUTE l_shoulderRotHi.value_changed TO hanim_l_shoulder.set_rotation
  ROUTE l_elbowRotHi.value_changed TO hanim_l_elbow.set_rotation
  ROUTE l_wristRotHi.value_changed TO hanim_l_wrist.set_rotation
  
  

and more


  #
  
  
  ##
  # file            : hanimanm_jump.wrl
  # description     : jump animation according to the Humanoid Animation Working Group humanoid standard.
  # author          : R.E. Blom
  # created         : 20-01-2000
  # modified        : 20-01-2000
  # remarks         : the animation is triggered by TimeGesture1.
  #                   Adapted from "<a href=http://www.ballreich.ne>/vrml/h-anim/nancy_h-anim.wrl".
  ##
  
  DEF Animations Group {
    children [
          DEF r_ankleRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.36, 0.4, 0.44, 0.48, 0.64, 0.76, 0.84, 0.88, 0.92, 0.96, 1 ]
            keyValue [ 0 0 1 0, -1 0 0 0.6735, -1 0 0 0.6735,
              -1 0 0 0.3527, -1 0 0 0.3038,
              -1 0 0 0.07964, 1 0 0 0.3001,
              1 0 0 0.6509, 1 0 0 0.3001,
              -1 0 0 0.2087, -1 0 0 0.3756,
              -1 0 0 0.3279, -1 0 0 0.1193, 0 0 1 0 ]
          }
          DEF r_kneeRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.48, 0.64, 0.76, 0.88, 1 ]
            keyValue [ 0 0 1 0, 1 0 0 2.005, 1 0 0 2.005,
              0 0 1 0, 1 0 0 0.9507, 1 0 0 0.5845,
              1 0 0 0.9054, 0 0 1 0 ]
          }
          DEF r_hipRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.36, 0.4, 0.44, 0.48, 0.64, 0.76, 0.88, 1 ]
            keyValue [ 0 0 1 0, 1 0 0 4.433, 1 0 0 4.433,
              1 0 0 4.647, -1 0 0 0.8943,
              -1 0 0 0.3698, 0 0 1 0, -1 0 0 0.4963,
              -1 0 0 0.3829, -1 0 0 0.5169, 0 0 1 0 ]
          }
          DEF l_ankleRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.36, 0.4, 0.44, 0.48, 0.64, 0.76, 0.84, 0.88, 0.92, 0.96, 1 ]
            keyValue [ 0 0 1 0, -1 0 0 0.625, -1 0 0 0.625,
              -1 0 0 0.3364, -1 0 0 0.2742,
              -1 0 0 0.05078, 1 0 0 0.2833,
              1 0 0 0.6667, 1 0 0 0.2833,
              -1 0 0 0.2108, -1 0 0 0.375,
              -1 0 0 0.3146, -1 0 0 0.1174, 0 0 1 0 ]
          }
          DEF l_kneeRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.48, 0.64, 0.76, 0.88, 1 ]
            keyValue [ 0 0 1 0, 1 0 0 2.047, 1 0 0 2.047,
              0 0 1 0, 1 0 0 1.566, 1 0 0 0.5913,
              1 0 0 0.9235, 0 0 1 0 ]
          }
          DEF l_hipRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.36, 0.4, 0.44, 0.48, 0.64, 0.76, 0.88, 1 ]
            keyValue [ 0 0 1 0, 1 0 0 4.349, 1 0 0 4.349,
              1 0 0 4.615, -1 0 0 0.9136,
              -1 0 0 0.3614, 0 0 1 0, -1 0 0 0.7869,
              -1 0 0 0.3918, -1 0 0 0.5433, 0 0 1 0 ]
          }
          DEF lower_bodyRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.48, 0.76, 1 ]
            keyValue [ 0 0 1 0, 1 0 0 0.1892, 1 0 0 0.1892,
              0 0 1 0, 0 0 1 0, 0 0 1 0 ]
          }
          DEF r_wristRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.64, 0.76, 1 ]
            keyValue [ 0 0 1 0, -0.0585279 0.983903 -0.168849 1.85956,
              -0.0585279 0.983903 -0.168849 1.85956,
              -0.00222418 0.99801 -0.0630095 1.46072,
              0 1 0 0.497349,
              0 0 1 0 ]
          }
          DEF r_elbowRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.64, 0.76, 1 ]
            keyValue [ 0 0 1 0, -1 0 0 0.04151,
              -1 0 0 0.04151, -1 0 0 0.5855,
              -1 0 0 0.5852, 0 0 1 0 ]
          }
          DEF r_shoulderRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.64, 0.76, 0.88, 1 ]
            keyValue [ 0 0 1 0, 0.9992 0.02042 0.03558 4.688,
              0.9992 0.02042 0.03558 4.688, 0.9989 -0.04623 0.005159 4.079,
              -0.8687 -0.2525 -0.4261 1.501, -0.941 -0.2893 -0.1754 0.4788, 0 0 1 0 ]
          }
          DEF l_wristRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.64, 0.76, 0.88, 1 ]
            keyValue [ 0 0 1 0, 0.0672928 0.989475 -0.128107 4.15574,
              0.0672928 0.989475 -0.128107 4.15574,
              0.00364942 0.999901 0.0135896 4.5822,
              0 -1 0 0.655922,
              -0.00050618 -0.999999 0.0012782 1.28397, 0 0 1 0 ]
          }
          DEF l_elbowRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.64, 0.76, 1 ]
            keyValue [ 0 0 1 0, -1 0 0 0.1229,
              -1 0 0 0.1229, -1 0 0 0.5976,
              -1 0 0 0.3917, 0 0 1 0 ]
          }
          DEF l_shoulderRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.64, 0.76, 0.88, 1 ]
            keyValue [ 0 0 1 0, -0.9987 0.02554 0.04498 1.57,
              -0.9987 0.02554 0.04498 1.57, 1 0.0004113 0.003055 4.114,
              -0.8413 0.3238 0.4329 1.453, -0.877 0.4198 0.2337 0.6009, 0 0 1 0 ]
          }
          DEF headRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.48, 0.76, 1 ]
            keyValue [ 0 0 1 0, -1 0 0 0.5989, -1 0 0 0.5989,
              -1 0 0 0.3216, 1 0 0 0.06503, 0 0 1 0 ]
          }
          DEF neckRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.48, 0.76, 1 ]
            keyValue [ 0 0 1 0, -1 0 0 0.1942, -1 0 0 0.1942,
              0 0 1 0, 1 0 0 0.2284, 0 0 1 0 ]
          }
          DEF upper_bodyRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.48, 0.76, 0.88, 1 ]
            keyValue [ 0 0 1 0, 1 0 0 1.038, 1 0 0 1.038,
              -1 0 0 0.1057, 1 0 0 0.2171,
              1 0 0 0.3465, 0 0 1 0 ]
          }
          DEF whole_bodyRotInterp_Jump OrientationInterpolator {
            key [ 0, 0.28, 0.32, 0.48, 0.64, 0.76, 1 ]
            keyValue [ 0 0 1 0, 1 0 0 0.3273, 1 0 0 0.3273,
              0 0 1 0, 0 0 1 0, 0 0 1 0, 0 0 1 0 ]
          }
          DEF whole_bodyTranInterp_Jump PositionInterpolator {
            key [ 0, 0.04, 0.08, 0.12, 0.16, 0.2, 0.24, 0.28, 0.32, 0.36, 0.4, 0.44,
              0.48, 0.64, 0.76, 0.8, 0.84, 0.88, 0.92, 0.96, 1 ]
            keyValue [ 0 0 0, 0 -0.01264 -0.01289, 0 -0.04712 -0.03738,
              -0.0003345 -0.1049 -0.05353, -0.0005712 -0.1892 -0.06561,
              -0.0008233 -0.286 -0.06276, -0.0009591 -0.3795 -0.05148,
              -0.00106 -0.4484 -0.03656, -0.00106 -0.4484 -0.03656,
              -0.001122 -0.3269 -0.1499, -0.0008616 -0.13 -0.06358,
              -0.0005128 -0.03123 -0.05488, 0.0004779 0.053 0.02732,
              0.0001728 0.4148 0.006873, 0 0.03045 0.02148,
              0 -0.01299 -0.01057, 0 -0.06932 -0.01064,
              0.0001365 -0.1037 -0.005059, 0.0001279 -0.07198 -0.007596,
              0.000141 -0.01626 -0.004935, 0 0 0 ]
          }
    ]
  }
  
  ROUTE TimeGesture1.fraction_changed TO r_ankleRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO r_kneeRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO r_hipRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO l_ankleRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO l_kneeRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO l_hipRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO lower_bodyRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO r_wristRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO r_elbowRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO r_shoulderRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO l_wristRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO l_elbowRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO l_shoulderRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO headRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO neckRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO upper_bodyRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO whole_bodyRotInterp_Jump.set_fraction
  ROUTE TimeGesture1.fraction_changed TO whole_bodyTranInterp_Jump.set_fraction
  
  ROUTE r_ankleRotInterp_Jump.value_changed TO hanim_r_ankle.set_rotation
  ROUTE r_kneeRotInterp_Jump.value_changed TO hanim_r_knee.set_rotation
  ROUTE r_hipRotInterp_Jump.value_changed TO hanim_r_hip.set_rotation
  ROUTE l_ankleRotInterp_Jump.value_changed TO hanim_l_ankle.set_rotation
  ROUTE l_kneeRotInterp_Jump.value_changed TO hanim_l_knee.set_rotation
  ROUTE l_hipRotInterp_Jump.value_changed TO hanim_l_hip.set_rotation
  ROUTE lower_bodyRotInterp_Jump.value_changed TO hanim_sacroiliac.set_rotation
  ROUTE r_wristRotInterp_Jump.value_changed TO hanim_r_wrist.set_rotation
  ROUTE r_elbowRotInterp_Jump.value_changed TO hanim_r_elbow.set_rotation
  ROUTE r_shoulderRotInterp_Jump.value_changed TO hanim_r_shoulder.set_rotation
  ROUTE l_wristRotInterp_Jump.value_changed TO hanim_l_wrist.set_rotation
  ROUTE l_elbowRotInterp_Jump.value_changed TO hanim_l_elbow.set_rotation
  ROUTE l_shoulderRotInterp_Jump.value_changed TO hanim_l_shoulder.set_rotation
  ROUTE headRotInterp_Jump.value_changed TO hanim_skullbase.set_rotation
  ROUTE neckRotInterp_Jump.value_changed TO hanim_vc4.set_rotation
  ROUTE upper_bodyRotInterp_Jump.value_changed TO hanim_vl1.set_rotation
  ROUTE whole_bodyRotInterp_Jump.value_changed TO hanim_HumanoidRoot.set_rotation
  ROUTE whole_bodyTranInterp_Jump.value_changed TO hanim_HumanoidRoot.set_translation
  
  #
  # include second part of lego-look avatar prototype.
  #
  
  
  ##
  # file            : hanimlegoavatarproto.wrl
  # description     : lego-look avatar prototype.
  # author          : R.E. Blom
  # created         : 20-01-2000
  # modified        : 28-01-2000
  # remarks         : hanimlegoavatarproto.wrl declares an Avatar proto according to the specifications
  #                   by Blaxxun.
  #                   The actual avatar geometry and animations are not hardcoded in this file, but
  #                   are #@included from separate files.
  #                   The following timers are DEFed in hanimlegoavatarproto.wrl and can be used to
  #                   trigger #@included animations:
  #                     TimeMove    : triggered when the avatar moves, this timer is used to move
  #                                   the avatar whenever it is not viewed in 3rd person mode or
  #                                   is viewed in another browser than that of the owner of the avatar.
  #                                   It is generally not necessary to use this timer to trigger
  #                                   animations, use TimeWalk instead.
  #                     TimeStop    : triggered when the avatar stops moving, this timer is currently
  #                                   used to reset the avatar to its neutral position.
  #                     TimeWalk    : triggered when the avatar moves, this timer can be used to
  #                                   run a walk animation while the avatar is moving.
  #                     TimeGesture1: triggered when the avatar receives a gesture1 event.
  #                     TimeGesture2: triggered when the avatar receives a gesture2 event.
  #                     TimeGesture3: triggered when the avatar receives a gesture3 event.
  #                     TimeGesture4: triggered when the avatar receives a gesture4 event.
  #                     TimeGesture5: triggered when the avatar receives a gesture5 event.
  #                     TimeGesture6: triggered when the avatar receives a gesture6 event.
  #                     TimeGesture7: triggered when the avatar receives a gesture7 event.
  #                     TimeGesture8: triggered when the avatar receives a gesture8 event.
  #                   The cycleinterval of each timer can be set by defining 1
  #                   through 1 respectively.
  ##
  
            DEF AvatarInterpolator PositionInterpolator {
              key [0, 1]
              keyValue [0 0 0, 0 0 0]
            }
  
            DEF AvatarScript Script {
              eventIn      SFVec3f    set_position       IS position
              eventIn      SFBool     timemoveisactive
              eventIn      SFBool     timestopisactive
              eventOut     SFTime     startmove
              eventOut     SFTime     startwalk
              eventOut     SFTime     stopwalk
              eventOut     MFVec3f    keyvalues_changed
              exposedField SFBool     ispilot            IS isPilot
              field        SFBool     moveactive         FALSE
              field        SFBool     newmove            FALSE
              field        SFVec3f    curposition        0 0 0
              field        MFVec3f    keyvalues          []
              field        SFNode     avatartransform    USE AnimatedAvatar
              field        SFNode     humanoid           USE Humanoid
              field        SFRotation defrotation        0 0 1 0
  
              directOutput TRUE
  
              url
                "vrmlscript:
                  function set_position(value, timestamp) {
                    if ((curposition[0]==value[0])&&(curposition[1]==value[1])&&(curposition[2]==value[2]))
                      return;
                    curposition=value;
                    if (ispilot) {
                      avatartransform.set_translation=value;
                      startwalk=timestamp;
                      stopwalk=timestamp+1;
                    }
                    else if (moveactive)
                      newmove=true;
                    else
                      move(timestamp);
                  }
                  function timemoveisactive(value, timestamp) {
                    moveactive=value;
                    if (!moveactive) {
                      if (newmove) {
                        newmove=false;
                        move(timestamp); 
                      }
                      else
                        stopwalk=timestamp;
                    }
                  }
                  function timestopisactive(value, timestamp) {
                    if (!value) {
                      for (i=0; i<17; i++)
                        humanoid.joints[i].rotation=defrotation;
                    }
                  }
                  function move(timestamp) {
                    if(!ispilot) { 
                      keyvalues[0]=avatartransform.translation_changed;
                      keyvalues[1]=curposition;
                      keyvalues_changed=keyvalues;
                      startmove=timestamp;
                      startwalk=timestamp;
                    }
                  }
                "
            }
          ]
        }
      ]
    }
  
    ROUTE AvatarScript.keyvalues_changed   TO AvatarInterpolator.set_keyValue
    ROUTE AvatarScript.startmove           TO TimeMove.set_startTime
    ROUTE AvatarScript.startwalk           TO TimeWalk.set_startTime
    ROUTE AvatarScript.stopwalk            TO TimeWalk.set_stopTime
    ROUTE AvatarScript.stopwalk            TO TimeStop.set_startTime
    ROUTE AvatarInterpolator.value_changed TO AnimatedAvatar.set_translation
    ROUTE TimeMove.fraction_changed        TO AvatarInterpolator.set_fraction
    ROUTE TimeMove.isActive                TO AvatarScript.timemoveisactive
    ROUTE TimeStop.isActive                TO AvatarScript.timestopisactive
  
  }
  
  Transform {
      translation 0 1 8
      children Avatar { }
  }
  
  


(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.