#VRML V2.0 utf8 #Ants Eyes -------------------------------------------- PROTO AntsEye [ field SFFloat eyeRadius 0.1 field SFColor eyeColor 1 1 0 ] { Shape { appearance Appearance { material Material { diffuseColor IS eyeColor } } geometry Sphere { radius IS eyeRadius } } } # END EYE PROTO # The Ant's head ----------------------------------------- PROTO AntsHead [ field SFFloat radius 0.25 field SFColor color 1 1 0 ] { Shape { appearance Appearance { material Material { diffuseColor IS color } } geometry Sphere { radius IS radius } } } # END HEAD PROTO PROTO AntsBodySegment [ field SFFloat bodySegmentRadius 0.25 field SFFloat bodySegmentLength 0.5 field SFColor bodyColor 1 1 0 ] { Group { children [ Transform { rotation 1 0 0 1.57 children [ Shape { appearance Appearance { material Material { diffuseColor IS bodyColor } } geometry Cylinder { height IS bodySegmentLength radius IS bodySegmentRadius } } ] }, Transform { translation 0 0 0.25 children [ Shape { appearance Appearance { material Material { diffuseColor IS bodyColor } } geometry Sphere { radius IS bodySegmentRadius } } ] }, Transform { translation 0 0 -0.25 children [ Shape { appearance Appearance { material Material { diffuseColor IS bodyColor } } geometry Sphere { radius IS bodySegmentRadius } } ] } ] } } PROTO AntClass [ field SFFloat bodyRadius 0.25 field SFColor bodyColor 1 1 0 field SFColor headColor 0 0 1 field SFColor leftEyeColor 0 1 0 field SFColor rightEyeColor 0 1 0 ] { Group { children [ AntsHead { color IS headColor }, Transform { translation -.13 .1 .1 children [ AntsEye { eyeColor IS rightEyeColor } ] }, Transform { translation .13 .1 .1 children [ AntsEye{ eyeColor IS leftEyeColor } ] }, Transform { translation 0 0 -0.7 children [ AntsBodySegment { bodyColor IS bodyColor bodySegmentRadius IS bodyRadius } ] }, Transform { translation 0 0 -1.6 children [ AntsBodySegment { bodyColor IS bodyColor bodySegmentRadius IS bodyRadius } ] }, ] } # Group } DEF Daniel AntClass {} DEF Patrick Transform { translation 2 0 0 children [ AntClass { bodyRadius 0.3 bodyColor 1 0 0 } ]} # 1 other ant defined and placed Transform { translation -2 1 0 rotation 0 1 0 0.6 children [ DEF Barbara AntClass { bodyRadius 0.3 bodyColor 0 0 1 headColor 1 1 0 leftEyeColor 1 0 0 rightEyeColor 1 0.6 0.1 } ] } # 1 other ant defined and placed (it has a hungry look) Transform { translation -1 1.3 -5 rotation 0 1 1 -0.6 # rotation 1 0 0 -0.3 children [ AntClass { bodyRadius 0.6 bodyColor 0.1 0.1 0.1 headColor 0.1 0.1 0.1 leftEyeColor 1 1 0 rightEyeColor 1 1 0 } ] } # 2 kids of Barbara DEF BarbaraBB Transform { translation -2.5 2 0 rotation 0 1 0 -0.8 scale 0.5 0.5 0.5 children [ USE Barbara Transform { translation -1 0 0 rotation 1 0 0 0.8 children USE Barbara } ] } NavigationInfo { type "EXAMINE"} # Use the Examine viewer