#VRML V2.0 utf8

WorldInfo {
  info [ "Robot model Copyright Viewpoint Datalabs Intl. Inc.
    www.viewpoint.com 800-643-8303 801-229-3333
    see license agreement for description of rights"
    "Modified by Bob Crispen to nest body parts
    properly, added some centers, added tray and bottle"
  ]
}

DEF BIG_PROX ProximitySensor {
  size 100 100 100
}

DEF BOT Transform {
  rotation 0 1 0 0
  translation 3 0.75 -2.5
  children [
    DEF BOT_TOUCH TouchSensor {  }
    DEF BOT_VISIBLE VisibilitySensor {
      size 1 1.5 1
    }
    DEF PELVIS Transform {
      children [
	Shape {
	  appearance DEF ARCHWHITE Appearance {
	    material Material {
	      ambientIntensity 0.2816
	      diffuseColor 0.9959 0.9959 0.9959
	      specularColor 0.5 0.5 0.5
	      shininess 0.05
	    }
	  }
	  geometry IndexedFaceSet {
	    coord Coordinate {
	      point [
		-0.127859 0.185551 0.068607
		0.127859 0.185551 0.068607
		0.127859 0.185551 -0.10291
		-0.127859 0.185551 -0.102911
		-0.14657 0.004678 0.077963
		-0.14657 0.004678 -0.127859
		0.14657 0.004678 -0.127859
		0.14657 0.004678 0.077963
	      ]
	    }
	    creaseAngle 1
	    coordIndex [
	      0 1 2 3 -1
	      4 5 6 7 -1
	      1 0 4 7 -1
	      0 3 5 4 -1
	      2 1 7 6 -1
	      3 2 6 5 -1
	    ]
	  }
	}
	
	DEF MY_MY_STOMACH_MY_KIDNEYS Transform {
	  center 0.118503 0.23 0.053015
	  rotation 1 0 0 0
	  children [
	    Shape {
	      appearance DEF BLACK Appearance {
		material Material {
		  ambientIntensity 0
		  diffuseColor 0.002 0.002 0.002
		  specularColor 0.5184 0.5184 0.5184
		  shininess 0.7868
		}
	      }
	      geometry IndexedFaceSet {
		coord Coordinate {
		  point [
		    -0.118503 0.169959 0.053014
		    -0.118503 0.169959 -0.081081
		    0.118503 0.169959 -0.081081
		    0.118503 0.169959 0.053015
		    0.118503 0.288462 0.053015
		    0.118503 0.288462 -0.081081
		    -0.118503 0.288462 -0.081081
		    -0.118503 0.288462 0.053015
		  ]
		}
		creaseAngle 1
		coordIndex [
		  0 1 2 3 -1
		  4 3 2 5 -1
		  5 2 1 6 -1
		  6 1 0 7 -1
		  5 6 7 4 -1
		  7 0 3 4 -1
		]
	      }
	    }
	    
	    DEF CHEST Transform {
	      children [
		Shape {
		  appearance USE ARCHWHITE
		  geometry IndexedFaceSet {
		    coord Coordinate {
		      point [
			-0.130977 0.266632 -0.090436
			0.130977 0.266632 -0.090436
			0.130977 0.266632 0.068607
			-0.130977 0.266632 0.068607
			-0.149688 0.531705 -0.093555
			-0.149688 0.531705 0.074844
			0.149688 0.531705 0.074844
			0.149688 0.531705 -0.093555
		      ]
		    }
		    creaseAngle 1
		    coordIndex [
		      0 1 2 3 -1
		      4 5 6 7 -1
		      2 1 7 6 -1
		      0 3 5 4 -1
		      1 0 4 7 -1
		      3 2 6 5 -1
		    ]
		  }
		}
		
		DEF RARM Transform {
		  center -0.15436 0.4974 -0.02774
		  rotation 0 0 1 0
		  children [
		    
		    DEF RSHOULDER Transform {
		      rotation 1 0 0 0
		      center -0.15436 0.4974 -0.02774
		      children [
			Shape {
			  appearance USE BLACK
			  geometry IndexedFaceSet {
			    coord Coordinate {
			      point [
				-0.137214 0.47869 -0.015592
				-0.171518 0.47869 -0.015592
				-0.171518 0.47869 -0.049896
				-0.137214 0.47869 -0.049896
				-0.171518 0.516112 -0.015592
				-0.171518 0.516112 -0.049896
				-0.137214 0.516112 -0.049896
				-0.137214 0.516112 -0.015592
			      ]
			    }
			    creaseAngle 1
			    coordIndex [
			      0 1 2 3 -1
			      4 5 2 1 -1
			      5 6 3 2 -1
			      6 7 0 3 -1
			      7 4 1 0 -1
			      5 4 7 6 -1
			    ]
			  }
			}
			
			DEF RUPPER_ARM Transform {
			  rotation 0 -1 0 0.3
			  center -0.15436 0.4974 -0.02774
			  children [
			    Shape {
			      appearance USE ARCHWHITE
			      geometry IndexedFaceSet {
				coord Coordinate {
				  point [
				    -0.240125 0.241684 -0.068607
				    -0.171518 0.241684 -0.068607
				    -0.171518 0.241684 0.006237
				    -0.240125 0.241684 0.006237
				    -0.159044 0.519231 0.024948
				    -0.159044 0.519231 -0.074844
				    -0.221414 0.519231 -0.074844
				    -0.221414 0.519231 0.024948
				  ]
				}
				creaseAngle 1
				coordIndex [
				  0 1 2 3 -1
				  4 5 6 7 -1
				  7 6 0 3 -1
				  5 4 2 1 -1
				  7 3 2 4 -1
				  5 1 0 6 -1
				]
			      }
			    }
			    
			    DEF RELBOW Transform {
			      rotation -1 0 0 1.570795
			      center -0.2058 0.234 -0.032
			      children [
				Shape {
				  appearance USE BLACK
				  geometry IndexedFaceSet {
				    coord Coordinate {
				      point [
					-0.18711 0.216736 -0.015592
					-0.224532 0.216736 -0.015592
					-0.224532 0.216736 -0.049896
					-0.18711 0.216736 -0.049896
					-0.224532 0.254158 -0.015592
					-0.224532 0.254158 -0.049896
					-0.18711 0.254158 -0.049896
					-0.18711 0.254158 -0.015592
				      ]
				    }
				    creaseAngle 1
				    coordIndex [
				      0 1 2 3 -1
				      4 5 2 1 -1
				      5 6 3 2 -1
				      6 7 0 3 -1
				      7 4 1 0 -1
				      5 4 7 6 -1
				    ]
				  }
				}
				
				DEF RFOREARM Transform {
				  rotation 0 1 0 1.570795
				  center -0.2058 0.234 -0.032
				  children [
				    Shape {
				      appearance USE ARCHWHITE
				      geometry IndexedFaceSet {
					coord Coordinate {
					  point [
					    -0.171518 0.226092 -0.059251
					    -0.233888 0.226092 -0.059252
					    -0.233888 0.226092 0.006237
					    -0.171518 0.226092 0.006237
					    -0.168399 -0.014033 -0.043659
					    -0.168399 -0.014033 0.012474
					    -0.212058 -0.014033 0.012474
					    -0.212058 -0.014033 -0.043659
					  ]
					}
					creaseAngle 1
					coordIndex [
					  0 1 2 3 -1
					  4 5 6 7 -1
					  1 7 6 2 -1
					  3 5 4 0 -1
					  2 6 5 3 -1
					  0 4 7 1 -1
					]
				      }
				    }
				    
				    DEF RWRIST Transform {
				      rotation 0 1 0 0
				      center -0.1886 -0.018 -0.017
				      children [
					Shape {
					  appearance USE ARCHWHITE
					  geometry IndexedFaceSet {
					    coord Coordinate {
					      point [
						-0.177755 -0.007796 -0.043659
						-0.177755 -0.007796 -0.021829
						-0.177755 -0.029625 -0.021829
						-0.177755 -0.029625 -0.043659
						-0.199584 -0.029625 -0.021829
						-0.199584 -0.029625 -0.043659
						-0.199584 -0.007796 -0.021829
						-0.199584 -0.007796 -0.043659
					      ]
					    }
					    creaseAngle 1
					    coordIndex [
					      0 1 2 3 -1
					      2 4 5 3 -1
					      6 7 5 4 -1
					      7 0 3 5 -1
					      1 6 4 2 -1
					      7 6 1 0 -1
					    ]
					  }
					}
					
					DEF RHAND Transform {
					  rotation 0 0 1 0
					  center -0.1886 -0.018 -0.017
					  children [
					    Shape {
					      appearance USE ARCHWHITE
					      geometry IndexedFaceSet {
						coord Coordinate {
						  point [
						    -0.212058 -0.02027 0.02183
						    -0.165281 -0.02027 0.02183
						    -0.165281 -0.02027 -0.046778
						    -0.212058 -0.02027 -0.046778
						    -0.183992 -0.148129 0.012474
						    -0.183992 -0.148129 -0.034304
						    -0.159044 -0.148129 -0.034304
						    -0.159044 -0.148129 0.012474
						  ]
						}
						creaseAngle 1
						coordIndex [
						  0 1 2 3 -1
						  4 5 6 7 -1
						  3 5 4 0 -1
						  1 7 6 2 -1
						  2 6 5 3 -1
						  0 4 7 1 -1
						]
					      }
					    }
					    DEF TRAY Transform {
					      translation -0.22 -0.1 -0.02
					      rotation 0 0 1 1.570795
					      children [
						Shape {
						  appearance Appearance {
						    material Material {
						      diffuseColor 1 0 0
						    }
						  }
						  geometry Cylinder {
						    height 0.02
						    radius 0.17
						  }
						}
						DEF BOTTLE Transform {
						  translation 0 0.08 0
						  children [
						    Shape {
						      appearance DEF BOTTLE_COLOR Appearance {
							material Material {
							  diffuseColor 0 0.5 0
							  transparency 0.3
							}
						      }
						      geometry Cylinder {
							height 0.14
							radius 0.03
							top FALSE
						      }
						    }
						    Transform {
						      translation 0 0.095 0
						      children [
							Shape {
							  appearance USE BOTTLE_COLOR
							  geometry Cone {
							    height 0.06
							    bottomRadius 0.03
							    bottom FALSE
							  }
							}
						      ]
						    }
						    Transform {
						      translation 0 0.12 0
						      children [
							Shape {
							  appearance USE BOTTLE_COLOR
							  geometry Cylinder {
							    height 0.09
							    radius 0.006
							  }
							}
						      ]
						    }
						  ]
						}
					      ]
					    }
					  ]
					}
				      ]
				    }
				  ]
				}
			      ]
			    }
			  ]
			}
		      ]
		    }
		  ]
		}
		
		DEF LARM Transform {
		  center 0.15436 0.49740 -0.02774
		  rotation 1 0 0 0
		  children [
		    
		    DEF LSHOULDER Transform {
		      center 0.15436 0.4974 -0.02774
		      rotation 0 0 1 0
		      children [
			Shape {
			  appearance USE BLACK
			  geometry IndexedFaceSet {
			    coord Coordinate {
			      point [
				0.137214 0.47869 -0.015592
				0.137214 0.47869 -0.049896
				0.171518 0.47869 -0.049896
				0.171518 0.47869 -0.015592
				0.171518 0.516112 -0.015592
				0.171518 0.516112 -0.049896
				0.137214 0.516112 -0.049896
				0.137214 0.516112 -0.015592
			      ]
			    }
			    creaseAngle 1
			    coordIndex [
			      0 1 2 3 -1
			      4 3 2 5 -1
			      5 2 1 6 -1
			      6 1 0 7 -1
			      7 0 3 4 -1
			      5 6 7 4 -1
			    ]
			  }
			}
			
			DEF LUPPER_ARM Transform {
			  rotation 0 0 1 0
			  children [
			    Shape {
			      appearance USE ARCHWHITE
			      geometry IndexedFaceSet {
				coord Coordinate {
				  point [
				    0.159044 0.519231 -0.074844
				    0.159044 0.519231 0.024948
				    0.221414 0.519231 0.024948
				    0.221414 0.519231 -0.074844
				    0.171518 0.241684 -0.068607
				    0.240125 0.241684 -0.068607
				    0.240125 0.241684 0.006237
				    0.171518 0.241684 0.006237
				  ]
				}
				creaseAngle 1
				coordIndex [
				  0 1 2 3 -1
				  4 5 6 7 -1
				  3 2 6 5 -1
				  1 0 4 7 -1
				  2 1 7 6 -1
				  0 3 5 4 -1
				]
			      }
			    }
			    
			    DEF LELBOW Transform {
			      rotation 1 0 0 0
			      center 0.2108 0.234 -0.032
			      children [
				Shape {
				  appearance USE BLACK
				  geometry IndexedFaceSet {
				    coord Coordinate {
				      point [
					0.18711 0.216736 -0.015592
					0.18711 0.216736 -0.049896
					0.224532 0.216736 -0.049896
					0.224532 0.216736 -0.015592
					0.224532 0.254158 -0.015592
					0.224532 0.254158 -0.049896
					0.18711 0.254158 -0.049896
					0.18711 0.254158 -0.015592
				      ]
				    }
				    creaseAngle 1
				    coordIndex [
				      0 1 2 3 -1
				      4 3 2 5 -1
				      5 2 1 6 -1
				      6 1 0 7 -1
				      7 0 3 4 -1
				      5 6 7 4 -1
				    ]
				  }
				}
				
				DEF LFOREARM Transform {
				  center 0.2108 0.234 -0.032
				  rotation 0 1 0 0
				  children [
				    Shape {
				      appearance USE ARCHWHITE
				      geometry IndexedFaceSet {
					coord Coordinate {
					  point [
					    0.171518 0.226092 -0.059251
					    0.171518 0.226092 0.006237
					    0.233888 0.226092 0.006237
					    0.233888 0.226092 -0.059251
					    0.165281 -0.014033 -0.043659
					    0.212058 -0.014033 -0.043659
					    0.212058 -0.014033 0.012474
					    0.165281 -0.014033 0.012474
					  ]
					}
					creaseAngle 1
					coordIndex [
					  0 1 2 3 -1
					  4 5 6 7 -1
					  3 2 6 5 -1
					  1 0 4 7 -1
					  0 3 5 4 -1
					  2 1 7 6 -1
					]
				      }
				    }
				    
				    DEF LWRIST Transform {
				      rotation 0 1 0 0
				      center 0.1886 -0.018 -0.017
				      children [
					Shape {
					  appearance USE ARCHWHITE
					  geometry IndexedFaceSet {
					    coord Coordinate {
					      point [
						0.177755 -0.029625 -0.006237
						0.177755 -0.029625 -0.028066
						0.199584 -0.029625 -0.028066
						0.199584 -0.029625 -0.006237
						0.199584 -0.007796 -0.006237
						0.199584 -0.007796 -0.028066
						0.177755 -0.007796 -0.028066
						0.177755 -0.007796 -0.006237
					      ]
					    }
					    creaseAngle 1
					    coordIndex [
					      0 1 2 3 -1
					      4 3 2 5 -1
					      5 2 1 6 -1
					      6 1 0 7 -1
					      7 0 3 4 -1
					      5 6 7 4 -1
					    ]
					  }
					}
					
					DEF LHAND Transform {
					  center 0.1991 -0.018 -0.017
					  rotation 0 0 1 0
					  children [
					    Shape {
					      appearance USE ARCHWHITE
					      geometry IndexedFaceSet {
						coord Coordinate {
						  point [
						    0.212058 -0.02027 0.02183
						    0.212058 -0.02027 -0.046777
						    0.165281 -0.02027 -0.046778
						    0.165281 -0.02027 0.02183
						    0.183992 -0.148129 0.012474
						    0.159044 -0.148129 0.012474
						    0.159044 -0.148129 -0.034304
						    0.183992 -0.148129 -0.034304
						  ]
						}
						creaseAngle 1
						coordIndex [
						  0 1 2 3 -1
						  4 5 6 7 -1
						  1 0 4 7 -1
						  3 2 6 5 -1
						  0 3 5 4 -1
						  2 1 7 6 -1
						]
					      }
					    }
					  ]
					}
				      ]
				    }
				  ]
				}
			      ]
			    }
			  ]
			}
		      ]
		    }
		  ]
		}
		
		DEF NECK Transform {
		  children [
		    Shape {
		      appearance USE BLACK
		      geometry IndexedFaceSet {
			coord Coordinate {
			  point [
			    -0.040541 0.516112 0.024948
			    -0.040541 0.516112 -0.059251
			    0.043659 0.516112 -0.059251
			    0.043659 0.516112 0.024948
			    0.043659 0.60343 0.024948
			    0.043659 0.60343 -0.059251
			    -0.040541 0.60343 -0.059251
			    -0.040541 0.60343 0.024948
			  ]
			}
			creaseAngle 1
			coordIndex [
			  0 1 2 3 -1
			  4 3 2 5 -1
			  5 2 1 6 -1
			  6 1 0 7 -1
			  7 0 3 4 -1
			  5 6 7 4 -1
			]
		      }
		    }
		    
		    
		    DEF HEAD Transform {
		      children [
			Shape {
			  appearance USE ARCHWHITE
			  geometry IndexedFaceSet {
			    coord Coordinate {
			      point [
				-0.049896 0.559771 0.0842
				-0.049896 0.559771 -0.084199
				0.053015 0.559771 -0.084199
				0.053015 0.559771 0.0842
				0.065489 0.75 0.0842
				0.065489 0.75 -0.084199
				-0.06237 0.75 -0.084199
				-0.06237 0.75 0.0842
			      ]
			    }
			    creaseAngle 1
			    coordIndex [
			      0 1 2 3 -1
			      4 3 2 5 -1
			      5 6 7 4 -1
			      6 1 0 7 -1
			      7 0 3 4 -1
			      5 2 1 6 -1
			    ]
			  }
			}
			
			DEF nose Transform {
			  children [
			    Shape {
			      appearance DEF BFLESH Appearance {
				material Material {
				  ambientIntensity 0.41
				  diffuseColor 0.41 0.11 0
				  specularColor 0.531 0.46 0.153
				  shininess 0.1008
				  transparency 0
				}
			      }
			      geometry IndexedFaceSet {
				coord Coordinate {
				  point [
				    0 0.684511 0.0842
				    0.003119 0.684511 0.0842
				    0.024948 0.612786 0.0842
				    -0.02183 0.612786 0.0842
				    0.003119 0.612786 0.12474
				  ]
				}
				creaseAngle 1
				coordIndex [
				  0 1 2 3 -1
				  3 2 4 -1
				  0 3 4 -1
				  1 0 4 -1
				  1 4 2 -1
				]
			      }
			    }
			  ]
			}
			
			DEF eyes Transform {
			  children [
			    Shape {
			      appearance USE BFLESH
			      geometry IndexedFaceSet {
				coord Coordinate {
				  point [
				    -0.046778 0.672037 0.099792
				    -0.046778 0.672037 0.0842
				    0.046778 0.672037 0.0842
				    0.046778 0.672037 0.099792
				    0.046778 0.68763 0.099792
				    0.046778 0.68763 0.0842
				    -0.046778 0.68763 0.0842
				    -0.046778 0.68763 0.099792
				  ]
				}
				creaseAngle 1
				coordIndex [
				  0 1 2 3 -1
				  4 3 2 5 -1
				  5 2 1 6 -1
				  6 1 0 7 -1
				  7 0 3 4 -1
				  5 6 7 4 -1
				]
			      }
			    }
			  ]
			}
			
			DEF EARS Transform {
			  children [
			    Shape {
			      appearance USE BFLESH
			      geometry IndexedFaceSet {
				coord Coordinate {
				  point [
				    0.049896 0.619023 0.018711
				    0.049896 0.619023 -0.006237
				    0.059252 0.615904 -0.006237
				    0.059252 0.615904 0.018711
				    -0.056133 0.615904 0.018711
				    -0.056133 0.615904 -0.006237
				    -0.046778 0.619023 -0.006237
				    -0.046778 0.619023 0.018711
				    -0.06237 0.693867 -0.018711
				    -0.077963 0.690748 -0.018711
				    -0.077963 0.690748 0.028067
				    -0.06237 0.693867 0.028067
				    0.077963 0.690748 0.031185
				    0.077963 0.690748 -0.015592
				    0.065489 0.693867 -0.018711
				    0.065489 0.693867 0.031185
				  ]
				}
				creaseAngle 1
				coordIndex [
				  0 1 2 3 -1
				  4 5 6 7 -1
				  8 9 10 11 -1
				  9 5 4 10 -1
				  12 3 2 13 -1
				  11 7 6 8 -1
				  14 1 0 15 -1
				  13 14 15 12 -1
				  15 0 3 12 -1
				  10 4 7 11 -1
				  8 6 5 9 -1
				  13 2 1 14 -1
				]
			      }
			    }
			  ]
			}
		      ]
		    }
		  ]
		}
	      ]
	    }
	  ]
	}
	
	
	DEF LLEG Transform {
	  children [
	    
	    DEF LHIP_JOINT Transform {
	      children [
		Shape {
		  appearance USE BLACK
		  geometry IndexedFaceSet {
		    coord Coordinate {
		      point [
			0.06237 -0.023388 0.015593
			0.06237 -0.023388 -0.031185
			0.106029 -0.023388 -0.031185
			0.106029 -0.023388 0.015593
			0.106029 0.023389 0.015593
			0.106029 0.023389 -0.031185
			0.06237 0.023389 -0.031185
			0.06237 0.023389 0.015593
		      ]
		    }
		    creaseAngle 1
		    coordIndex [
		      0 1 2 3 -1
		      4 3 2 5 -1
		      5 2 1 6 -1
		      6 1 0 7 -1
		      7 0 3 4 -1
		      5 6 7 4 -1
		    ]
		  }
		}
		
		DEF LTHIGH Transform {
		  children [
		    Shape {
		      appearance USE ARCHWHITE
		      geometry IndexedFaceSet {
			coord Coordinate {
			  point [
			    0.012474 -0.347713 -0.053015
			    0.112266 -0.347713 -0.053015
			    0.112266 -0.347713 0.034304
			    0.012474 -0.347713 0.034304
			    0.006237 -0.004677 -0.081081
			    0.006237 -0.004677 0.065489
			    0.14657 -0.004677 0.065489
			    0.14657 -0.004677 -0.081081
			  ]
			}
			creaseAngle 1
			coordIndex [
			  0 1 2 3 -1
			  4 5 6 7 -1
			  1 0 4 7 -1
			  3 2 6 5 -1
			  2 1 7 6 -1
			  0 3 5 4 -1
			]
		      }
		    }
		    DEF LKNEE Transform {
		      children [
			Shape {
			  appearance USE BLACK
			  geometry IndexedFaceSet {
			    coord Coordinate {
			      point [
				0.043659 -0.37578 0.015592
				0.043659 -0.37578 -0.024948
				0.081081 -0.37578 -0.024948
				0.081081 -0.37578 0.015592
				0.081081 -0.335239 0.015592
				0.081081 -0.335239 -0.024948
				0.043659 -0.335239 -0.024948
				0.043659 -0.335239 0.015592
			      ]
			    }
			    creaseAngle 1
			    coordIndex [
			      0 1 2 3 -1
			      4 3 2 5 -1
			      5 2 1 6 -1
			      6 1 0 7 -1
			      7 0 3 4 -1
			      5 6 7 4 -1
			    ]
			  }
			}
			
			DEF LCALF Transform {
			  children [
			    Shape {
			      appearance USE ARCHWHITE
			      geometry IndexedFaceSet {
				coord Coordinate {
				  point [
				    0.024948 -0.681393 -0.040541
				    0.0842 -0.681393 -0.040541
				    0.0842 -0.681393 0.006237
				    0.024948 -0.681393 0.006237
				    0.015592 -0.363306 -0.065489
				    0.015592 -0.363306 0.031185
				    0.106029 -0.363306 0.031185
				    0.106029 -0.363306 -0.065489
				  ]
				}
				creaseAngle 1
				coordIndex [
				  0 1 2 3 -1
				  4 5 6 7 -1
				  1 0 4 7 -1
				  3 2 6 5 -1
				  2 1 7 6 -1
				  0 3 5 4 -1
				]
			      }
			    }
			    
			    DEF LANKLE Transform {
			      children [
				Shape {
				  appearance USE ARCHWHITE
				  geometry IndexedFaceSet {
				    coord Coordinate {
				      point [
					0.037422 -0.700104 0.003118
					0.037422 -0.700104 -0.037422
					0.077963 -0.700104 -0.037422
					0.077963 -0.700104 0.003118
					0.077963 -0.668919 0.003118
					0.077963 -0.668919 -0.037422
					0.037422 -0.668919 -0.037422
					0.037422 -0.668919 0.003118
				      ]
				    }
				    creaseAngle 1
				    coordIndex [
				      0 1 2 3 -1
				      4 3 2 5 -1
				      5 2 1 6 -1
				      6 1 0 7 -1
				      7 0 3 4 -1
				      5 6 7 4 -1
				    ]
				  }
				}
				
				DEF LHEEL Transform {
				  children [
				    Shape {
				      appearance USE ARCHWHITE
				      geometry IndexedFaceSet {
					coord Coordinate {
					  point [
					    0.090437 -0.693867 -0.012474
					    0.018711 -0.693867 -0.012474
					    0.018711 -0.75 -0.012474
					    0.090437 -0.75 -0.012474
					    0.018711 -0.693867 -0.068607
					    0.018711 -0.75 -0.068607
					    0.087318 -0.693867 -0.068607
					    0.087318 -0.75 -0.068607
					  ]
					}
					creaseAngle 1
					coordIndex [
					  0 1 2 3 -1
					  2 1 4 5 -1
					  6 7 5 4 -1
					  0 3 7 6 -1
					  1 0 6 4 -1
					  3 2 5 7 -1
					]
				      }
				    }
				    
				    DEF LFOOT_JOINT Transform {
				      children [
					Shape {
					  appearance USE BLACK
					  geometry IndexedFaceSet {
					    coord Coordinate {
					      point [
						0.043659 -0.731289 0.003118
						0.043659 -0.731289 -0.02183
						0.068607 -0.731289 -0.02183
						0.068607 -0.731289 0.003118
						0.068607 -0.715696 0.003118
						0.068607 -0.715696 -0.02183
						0.043659 -0.715696 -0.02183
						0.043659 -0.715696 0.003118
					      ]
					    }
					    creaseAngle 1
					    coordIndex [
					      0 1 2 3 -1
					      4 3 2 5 -1
					      5 2 1 6 -1
					      6 1 0 7 -1
					      7 0 3 4 -1
					      5 6 7 4 -1
					    ]
					  }
					}
					
					DEF LFOOT Transform {
					  children [
					    Shape {
					      appearance USE ARCHWHITE
					      geometry IndexedFaceSet {
						coord Coordinate {
						  point [
						    0.090437 -0.693867 -0.009356
						    0.090437 -0.740644 -0.009356
						    0.018711 -0.740644 -0.009356
						    0.018711 -0.693867 -0.009356
						    0.096674 -0.725052 0.118503
						    0.018711 -0.725052 0.127859
						    0.018711 -0.75 0.127859
						    0.096674 -0.75 0.118503
						  ]
						}
						creaseAngle 1
						coordIndex [
						  0 1 2 3 -1
						  4 5 6 7 -1
						  6 5 3 2 -1
						  4 7 1 0 -1
						  7 6 2 1 -1
						  5 4 0 3 -1
						]
					      }
					    }
					  ]
					}
				      ]
				    }
				  ]
				}
			      ]
			    }
			  ]
			}
		      ]
		    }
		  ]
		}
	      ]
	    }
	  ]
	}
	
	DEF RLEG Transform {
	  children [
	    
	    DEF RHIP_JOINT Transform {
	      children [
		Shape {
		  appearance USE BLACK
		  geometry IndexedFaceSet {
		    coord Coordinate {
		      point [
			-0.059252 -0.023388 0.015593
			-0.106029 -0.023388 0.015593
			-0.106029 -0.023388 -0.031185
			-0.059252 -0.023388 -0.031185
			-0.106029 0.023389 0.015593
			-0.106029 0.023389 -0.031185
			-0.059252 0.023389 -0.031185
			-0.059252 0.023389 0.015593
		      ]
		    }
		    creaseAngle 1
		    coordIndex [
		      0 1 2 3 -1
		      4 5 2 1 -1
		      5 6 3 2 -1
		      6 7 0 3 -1
		      7 4 1 0 -1
		      5 4 7 6 -1
		    ]
		  }
		}
		
		DEF RTHIGH Transform {
		  children [
		    Shape {
		      appearance USE ARCHWHITE
		      geometry IndexedFaceSet {
			coord Coordinate {
			  point [
			    -0.112266 -0.347713 -0.053015
			    -0.009356 -0.347713 -0.053015
			    -0.009356 -0.347713 0.034304
			    -0.112266 -0.347713 0.034304
			    -0.14657 -0.004677 -0.081081
			    -0.14657 -0.004677 0.065489
			    -0.003119 -0.004677 0.065489
			    -0.003118 -0.004677 -0.081081
			  ]
			}
			creaseAngle 1
			coordIndex [
			  0 1 2 3 -1
			  4 5 6 7 -1
			  1 0 4 7 -1
			  3 2 6 5 -1
			  0 3 5 4 -1
			  2 1 7 6 -1
			]
		      }
		    }
		    
		    DEF RKNEE Transform {
		      children [
			Shape {
			  appearance USE BLACK
			  geometry IndexedFaceSet {
			    coord Coordinate {
			      point [
				-0.040541 -0.37578 0.015592
				-0.081081 -0.37578 0.015592
				-0.081081 -0.37578 -0.024948
				-0.040541 -0.37578 -0.024948
				-0.081081 -0.335239 0.015592
				-0.081081 -0.335239 -0.024948
				-0.040541 -0.335239 -0.024948
				-0.040541 -0.335239 0.015592
			      ]
			    }
			    creaseAngle 1
			    coordIndex [
			      0 1 2 3 -1
			      4 5 2 1 -1
			      5 6 3 2 -1
			      6 7 0 3 -1
			      7 4 1 0 -1
			      5 4 7 6 -1
			    ]
			  }
			}
			
			DEF RCALF Transform {
			  children [
			    Shape {
			      appearance USE ARCHWHITE
			      geometry IndexedFaceSet {
				coord Coordinate {
				  point [
				    -0.106029 -0.363306 -0.065489
				    -0.106029 -0.363306 0.031185
				    -0.012474 -0.363306 0.031185
				    -0.012474 -0.363306 -0.065489
				    -0.0842 -0.681393 -0.040541
				    -0.02183 -0.681393 -0.040541
				    -0.02183 -0.681393 0.006237
				    -0.0842 -0.681393 0.006237
				  ]
				}
				creaseAngle 1
				coordIndex [
				  0 1 2 3 -1
				  4 5 6 7 -1
				  4 7 1 0 -1
				  6 5 3 2 -1
				  5 4 3 -1
				  7 6 1 -1
				  4 0 3 -1
				  6 2 1 -1
				]
			      }
			    }
			    
			    DEF RANKLE Transform {
			      children [
				Shape {
				  appearance USE BLACK
				  geometry IndexedFaceSet {
				    coord Coordinate {
				      point [
					-0.034304 -0.700104 0.003118
					-0.074844 -0.700104 0.003118
					-0.074844 -0.700104 -0.037422
					-0.034304 -0.700104 -0.037422
					-0.074844 -0.668919 0.003118
					-0.074844 -0.668919 -0.037422
					-0.034304 -0.668919 -0.037422
					-0.034304 -0.668919 0.003118
				      ]
				    }
				    creaseAngle 1
				    coordIndex [
				      0 1 2 3 -1
				      4 5 2 1 -1
				      5 6 3 2 -1
				      6 7 0 3 -1
				      7 4 1 0 -1
				      5 4 7 6 -1
				    ]
				  }
				}
				
				DEF RHEEL Transform {
				  children [
				    Shape {
				      appearance USE ARCHWHITE
				      geometry IndexedFaceSet {
					coord Coordinate {
					  point [
					    -0.090437 -0.693867 -0.012474
					    -0.090437 -0.75 -0.012474
					    -0.015592 -0.75 -0.012474
					    -0.015592 -0.693867 -0.012474
					    -0.015592 -0.75 -0.068607
					    -0.015592 -0.693867 -0.068607
					    -0.087318 -0.693867 -0.068607
					    -0.087318 -0.75 -0.068607
					  ]
					}
					creaseAngle 1
					coordIndex [
					  0 1 2 3 -1
					  2 4 5 3 -1
					  6 5 4 7 -1
					  0 6 7 1 -1
					  3 5 6 0 -1
					  1 7 4 2 -1
					]
				      }
				    }
				    
				    DEF RFOOT_JOINT Transform {
				      children [
					Shape {
					  appearance USE BLACK
					  geometry IndexedFaceSet {
					    coord Coordinate {
					      point [
						-0.065489 -0.731289 0.003118
						-0.065489 -0.731289 -0.02183
						-0.040541 -0.731289 -0.02183
						-0.040541 -0.731289 0.003118
						-0.040541 -0.715696 0.003118
						-0.040541 -0.715696 -0.02183
						-0.065489 -0.715696 -0.02183
						-0.065489 -0.715696 0.003118
					      ]
					    }
					    creaseAngle 1
					    coordIndex [
					      0 1 2 3 -1
					      4 3 2 5 -1
					      5 2 1 6 -1
					      6 1 0 7 -1
					      7 0 3 4 -1
					      5 6 7 4 -1
					    ]
					  }
					}
					
					DEF RFOOT Transform {
					  children [
					    Shape {
					      appearance USE ARCHWHITE
					      geometry IndexedFaceSet {
						coord Coordinate {
						  point [
						    -0.090437 -0.693867 -0.009356
						    -0.015592 -0.693867 -0.009356
						    -0.015592 -0.740644 -0.009356
						    -0.090437 -0.740644 -0.009356
						    -0.096674 -0.725052 0.118503
						    -0.096674 -0.75 0.118503
						    -0.015593 -0.75 0.127859
						    -0.015593 -0.725052 0.127859
						  ]
						}
						creaseAngle 1
						coordIndex [
						  0 1 2 3 -1
						  4 5 6 7 -1
						  6 2 1 7 -1
						  4 0 3 5 -1
						  5 3 2 6 -1
						  7 1 0 4 -1
						]
					      }
					    }
					  ]
					}
				      ]
				    }
				  ]
				}
			      ]
			    }
			  ]
			}
		      ]
		    }
		  ]
		}
	      ]
	    }
	  ]
	}
      ]
    }
  ]
}

DEF CIRCLE_TIME TimeSensor {
  enabled FALSE
  loop TRUE
  cycleInterval 60
}

DEF LEG_TIME TimeSensor {
  enabled FALSE
  loop TRUE
  cycleInterval 3
}

DEF BOW_TIME TimeSensor {
  cycleInterval 3
}

DEF LLEG_INTERP OrientationInterpolator {
  key [ 0 0.25 0.5 0.75 1 ]
  keyValue [ 1 0 0 0, 1 0 0 0.4, 1 0 0 0, 1 0 0 -0.4, 1 0 0 0 ]
}

DEF RLEG_INTERP OrientationInterpolator {
  key [ 0 0.25 0.5 0.75 1 ]
  keyValue [ 1 0 0 0, 1 0 0 -0.4, 1 0 0 0, 1 0 0 0.4, 1 0 0 0 ]
}

DEF BOW_INTERP OrientationInterpolator {
  key [ 0 0.5 1 ]
  keyValue [ 1 0 0 0, 1 0 0 1, 1 0 0 0 ]
}

DEF ARM_INTERP OrientationInterpolator {
  key [ 0 0.5 1 ]
  keyValue [ 1 0 0 0, 1 0 0 -1, 1 0 0 0 ]
}

DEF CIRCLE_POS PositionInterpolator {
  key [ 0 0.25 0.5 0.75 1 ]
  keyValue [ 3 0.75 -2.5, 3 0.75 2.5, -3 0.75 2.5, -3 0.75 -2.5, 3 0.75 -2.5 ]
}

DEF CIRCLE_ROT OrientationInterpolator {
  key [ 0 0.24 0.25 0.49 0.50 0.74 0.75 0.99 1 ]
  keyValue [
    0 1 0 0, 0 1 0 0, 0 1 0 -1.570795, 0 1 0 -1.570795, 0 1 0 -3.14159,
    0 1 0 -3.14159, 0 1 0 -4.712385, 0 1 0 -4.712385, 0 1 0 -6.28318 ]
}

DEF BOT_MOVE Script {
  eventIn SFBool do_visibility
  eventIn SFBool do_touch
  eventIn SFFloat buffer_leg
  eventIn SFRotation buffer_rot
  eventOut SFFloat buffer_leg_out
  eventOut SFRotation buffer_rot_out
  directOutput TRUE
  field SFNode leg_timer USE LEG_TIME
  field SFNode circle_timer USE CIRCLE_TIME
  field SFNode bow_timer USE BOW_TIME
  field SFNode big_prox USE BIG_PROX
  field SFNode bot USE BOT
  field SFVec3f my_position 0 0 0
  field SFVec3f bot_position 0 0 0
  field SFRotation bot_orientation 0 1 0 0
  field SFBool walking TRUE
  
  url [ "javascript:
    
    // Start with the bot walking
    function initialize() {
      leg_timer.set_enabled = true;
      circle_timer.set_enabled = true;
    }
    
    // Common code
    function walk(timestamp) {
      walking = true;
      leg_timer.set_enabled = true;
      circle_timer.set_enabled = true;
      leg_timer.set_startTime = leg_timer.startTime + timestamp - leg_timer.stopTime;
      circle_timer.startTime = circle_timer.startTime + timestamp - circle_timer.stopTime;
      leg_timer.set_stopTime = 0;
      circle_timer.set_stopTime = 0;
    }
    
    // Common code
    function stop (timestamp) {
      walking = false;
      leg_timer.set_stopTime = timestamp;
      circle_timer.set_stopTime = timestamp;
    }
    
    // Let the bot walk only when it's visible
    function do_visibility(value, timestamp) {
      if (value)
	walk(timestamp);
      else
	stop(timestamp);
    }
    
    // Let the value pass to the legs only if the bot is walking.
    // Otherwise, bring the legs together.
    function buffer_leg (value) {
      if (walking)
	buffer_leg_out = value;
      else
	buffer_leg_out = 0;
    }
    
    // Let the position change only if we're walking. Otherwise,
    // orient the bot toward the current viewpoint.
    function buffer_rot (value) {
      if (walking) {
	buffer_rot_out = value;
      } else {
	bot_position = bot.translation_changed;
	my_position = big_prox.position_changed;
	bot_orientation.x = 0;
	bot_orientation.y = 1;
	bot_orientation.z = 0;
	if (my_position.x == bot_position.x)
	  bot_orientation.angle = -Math.PI/2;
	else
	  bot_orientation.angle = Math.atan(
	    (my_position.z - bot_position.z)/(bot_position.x - my_position.x)) - Math.PI/2;
	if (bot_position.x < my_position.x)
	  bot_orientation.angle += Math.PI;
	buffer_rot_out = bot_orientation;
      }
    }
    
    // Touching the bot makes him stop and bow
    function do_touch (value, timestamp) {
      if (value) {
	if (walking) {
	  stop(timestamp);
	  bow_timer.set_startTime = timestamp;
	} else {
	  walk(timestamp);
	}
      }
    }
" ]
}


ROUTE BOT_TOUCH.isActive TO BOT_MOVE.do_touch
ROUTE BOT_VISIBLE.isActive TO BOT_MOVE.do_visibility
ROUTE LEG_TIME.fraction_changed TO BOT_MOVE.buffer_leg
ROUTE BOT_MOVE.buffer_leg_out TO LLEG_INTERP.set_fraction
ROUTE BOT_MOVE.buffer_leg_out TO RLEG_INTERP.set_fraction
ROUTE BOW_TIME.fraction_changed TO BOW_INTERP.set_fraction
ROUTE BOW_TIME.fraction_changed TO ARM_INTERP.set_fraction
ROUTE LLEG_INTERP.value_changed TO LLEG.set_rotation
ROUTE RLEG_INTERP.value_changed TO RLEG.set_rotation
ROUTE RLEG_INTERP.value_changed TO LARM.set_rotation
ROUTE ARM_INTERP.value_changed TO RSHOULDER.set_rotation
ROUTE BOW_INTERP.value_changed TO MY_MY_STOMACH_MY_KIDNEYS.set_rotation
ROUTE CIRCLE_TIME.fraction_changed TO CIRCLE_POS.set_fraction
ROUTE CIRCLE_TIME.fraction_changed TO CIRCLE_ROT.set_fraction
ROUTE CIRCLE_POS.value_changed TO BOT.set_translation
ROUTE CIRCLE_ROT.value_changed TO BOT_MOVE.buffer_rot
ROUTE BOT_MOVE.buffer_rot_out TO BOT.set_rotation