#VRML V2.0 utf8 PROTO fishProto[ exposedField MFString skinTexture [ "" ] exposedField SFVec3f fishScale 1 1 1 exposedField SFColor fishDifColor 0.7 0.7 0.7 ] { Transform{ scale IS fishScale children[ DEF WAY Transform{ children Transform{ translation 4 0 0 children Transform{ rotation 1 0 0 90 children [ Shape { appearance Appearance { material Material { diffuseColor IS fishDifColor } texture ImageTexture{ url IS skinTexture } } geometry DEF FISH_SHAPE Extrusion { creaseAngle 1.57 crossSection [ 1.00 0.00, 0.92 -0.38, 0.71 -0.71, 0.38 -0.92, 0.00 -1.00, -0.38 -0.92, -0.71 -0.71, -0.92 -0.38, -1.00 -0.00, -0.92 0.38, -0.71 0.71, -0.38 0.92, 0.00 1.00, 0.38 0.92, 0.71 0.71, 0.92 0.38, 1.00 0.00 ] spine [ 0 3.51 0, 0 3.50 0, 0 2.80 0, 0 2.3 0, 0 1.5 0, 0 0.5 0, 0 0 0, 0 -0.6 0 ] scale[ 0.03 0.03 0.1 0.15, 0.4 0.7, 0.5 0.75, 0.4 0.55, 0.2 0.3, 0.05 0.1, 0.03 0.6 ] } } Shape { appearance DEF FIN_SKIN Appearance { material Material { diffuseColor 0.7 0.7 0.7 transparency 0.3 } } geometry IndexedFaceSet { coord DEF PELVIC Coordinate{ point[ 0 2.2 0.6, 0 2.2 -0.7, 0 0.3 -0.3, 0 0.7 0.5, ] } coordIndex[ 0, 1, 2 , 3, -1 ] solid FALSE } } Transform{ translation 0.3 2.8 -0.4 children DEF EYE Shape{ appearance Appearance { material Material { shininess 1 diffuseColor 0.5 0.5 0.5 specularColor 0.3 0.3 0.3 } } geometry Sphere{ radius 0.08 } } } Transform{ translation -0.3 2.8 -0.4 children USE EYE } Transform{ #Mouth scale 2.6 1 0.7 translation 0 3.44 -0.1 children USE EYE } DEF LEFT_PECTORAL Transform{ translation -0.3 2.7 0.1 children Shape{ appearance USE FIN_SKIN geometry IndexedFaceSet { coord Coordinate{ point[ 0 0 0, -0.5 -0.2 0.1, -0.25 0.2 0.25, ] } coordIndex[ 0, 1, 2, -1 ] solid FALSE } } } DEF RIGHT_PECTORAL Transform{ translation 0.3 2.7 0.1 children Shape{ appearance USE FIN_SKIN geometry IndexedFaceSet { coord Coordinate{ point[ 0 0 0, 0.5 -0.2 0.1, 0.25 0.2 0.25, ] } coordIndex[ 0, 1, 2, -1 ] solid FALSE } } } ] } } } # END of ROUTE DEF ROUTE_TIMER TimeSensor { cycleInterval 50 loop TRUE } DEF TIMER TimeSensor { cycleInterval 1.5 loop TRUE } DEF WAGGLER CoordinateInterpolator { key [ 0.0, 0.5, 1.0 ] keyValue [ # time 0.0 position 0 3.55 0, 0 3.50 0, 0 2.80 0, 0 2.3 0, -0.05 1.5 0, 0.1 0.5 0, 0.2 0 0, 0.3 -0.6 0 # time 0.5 position 0 3.55 0, 0 3.50 0, 0 2.80 0, 0 2.3 0, 0.05 1.5 0, -0.1 0.5 0, -0.2 0 0, -0.3 -0.6 0 # time 1.0 position 0 3.55 0, 0 3.50 0, 0 2.80 0, 0 2.3 0, -0.05 1.5 0, 0.1 0.5 0, 0.2 0 0, 0.3 -0.6 0 ] } DEF POINTS CoordinateInterpolator { key [ 0.0, 0.5, 1.0 ] keyValue [ # time 0.0 position 0 2.2 0.6, 0 2.2 -0.7, 0.2 0.3 -0.3, 0.2 0.7 0.5, # time 0.5 position 0 2.2 0.6, 0 2.2 -0.7, -0.2 0.3 -0.3, -0.2 0.7 0.5, # time 1.0 position 0 2.2 0.6, 0 2.2 -0.7, 0.2 0.3 -0.3, 0.2 0.7 0.5, ] } DEF LEFT_PECTORAL_ROT OrientationInterpolator{ key[ 0 0.3 0.7 1 ] keyValue[ 0 1 0 30 0 1 0 0 0 1 0 0 0 1 0 30 ] } DEF RIGHT_PECTORAL_ROT OrientationInterpolator{ key[ 0 0.3 0.7 1 ] keyValue[ 0 1 0 -30 0 1 0 0 0 1 0 0 0 1 0 -30 ] } DEF TURN OrientationInterpolator{ key[ 0 0.25 0.5 0.75 1 ] keyValue[ 0 1 0 0 0 1 0 -90 0 1 0 -180 0 1 0 -270 0 1 0 0 ] } ]} ROUTE TIMER.fraction_changed TO WAGGLER.set_fraction ROUTE WAGGLER.value_changed TO FISH_SHAPE.set_spine ROUTE TIMER.fraction_changed TO POINTS.set_fraction ROUTE POINTS.value_changed TO PELVIC.set_point ROUTE TIMER.fraction_changed TO LEFT_PECTORAL_ROT.set_fraction ROUTE LEFT_PECTORAL_ROT.value_changed TO LEFT_PECTORAL.set_rotation ROUTE TIMER.fraction_changed TO RIGHT_PECTORAL_ROT.set_fraction ROUTE RIGHT_PECTORAL_ROT.value_changed TO RIGHT_PECTORAL.set_rotation ROUTE ROUTE_TIMER.fraction_changed TO TURN.set_fraction ROUTE TURN.value_changed TO WAY.set_rotation }