<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  <head>
    <meta content='NonLethalNetLauncherPrototype.x3d' name='title'/>
    <meta content='Simple model that depicts small boat launched net entanglement system.' name='description'/>
    <meta content='James Harney' name='creator'/>
    <meta content='14 March 2002' name='created'/>
    <meta content='28 November 2019' name='modified'/>
    <meta content='https://www.web3d.org/x3d/content/examples/Savage/Weapons/Guns/NonLethalNetLauncherPrototype.x3d' name='identifier'/>
    <meta content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='../../license.html' name='license'/>
  </head>
  <Scene>
    <WorldInfo title='NonLethalNetLauncherPrototype.x3d'/>
    <NavigationInfo speed='10'/>
    <ProtoDeclare appinfo='Nonlethal Net Launcher to repel boarders' name='NetLauncher'>
      <ProtoInterface>
        <field accessType='inputOnly' name='startLaunchToStbd' type='SFTime'/>
        <field accessType='inputOnly' name='startLaunchToPort' type='SFTime'/>
        <field accessType='outputOnly' name='netTranslation' type='SFVec3f'/>
        <field accessType='outputOnly' name='netScale' type='SFVec3f'/>
        <field accessType='outputOnly' name='netOrientation' type='SFRotation'/>
        <field accessType='outputOnly' name='nettingScale' type='SFVec3f'/>
      </ProtoInterface>
      <ProtoBody>
        <Group>
          <Background groundAngle='1.309 1.570796' groundColor='0.1 0.1 0 0.4 0.25 0.2 0.6 0.6 0.6' skyAngle='1.309 1.571' skyColor='0 0.2 0.7 0 0.5 1 1 1 1'/>
          <!-- Note that the term stbd refers to the position of the launcher tube and is 180 the direction of launch -->
          <Transform>
            <Viewpoint DEF='STBD' description='Net Launcher stbd View' jump='false' orientation='1 0 0 -.2' position='0 5 12'/>
            <Viewpoint DEF='FRONT' description='Net Launcher Front View' orientation='0 1 0 1.57' position='12 3 0'/>
            <Viewpoint DEF='PORT' description='Net Launcher Port View' jump='false' orientation='0 1 0 3.14' position='0 3 -12'/>
            <Viewpoint DEF='REAR' description='Net Launcher Rear View' orientation='0 1 0 -1.57' position='-12 3 0'/>
          </Transform>
          <TimeSensor DEF='NetPositClock' cycleInterval='3'>
            <IS>
              <connect nodeField='startTime' protoField='startLaunchToStbd'/>
            </IS>
          </TimeSensor>
          <TimeSensor DEF='NetPositClockStbd' cycleInterval='3'>
            <IS>
              <connect nodeField='startTime' protoField='startLaunchToPort'/>
            </IS>
          </TimeSensor>
          <PositionInterpolator DEF='NetPositInterp' key='0 .5 1' keyValue='0 0 0 0 25 10 0 7.5 21'>
            <IS>
              <connect nodeField='value_changed' protoField='netTranslation'/>
            </IS>
          </PositionInterpolator>
          <PositionInterpolator DEF='NetPositInterpStbd' key='0 .5 1' keyValue='0 0 0 0 25 -10 0 7.5 -21'/>
          <PositionInterpolator DEF='NetPositScale' key='.1 1.0' keyValue='1 1 1 1 8 1'/>
          <PositionInterpolator DEF='NetPositScaleStbd' key='.1 1.0' keyValue='1 1 1 1 8 1'/>
          <PositionInterpolator DEF='NettingScale' key='.3 1' keyValue='.01 .01 .01 1 2 1'/>
          <PositionInterpolator DEF='NettingScaleStbd' key='.3 1' keyValue='.01 .01 .01 1 2 1'/>
          <OrientationInterpolator DEF='NetOrientInterp' key='0 .5 .9 1' keyValue='1 0 0 0 1 0 0 .78 1 0 0 1 1 0 0 .78'/>
          <OrientationInterpolator DEF='NetOrientInterpStbd' key='0 .5 .9 1' keyValue='1 0 0 0 1 0 0 -.78 1 0 0 -1 1 0 0 -.78'/>
          <Transform DEF='TubeTransform'>
            <Transform DEF='PortTubeTransform' rotation='1 0 0 .78'>
              <Shape>
                <Appearance>
                  <Material diffuseColor='.9 .9 .9' shininess='1'/>
                </Appearance>
                <Cylinder height='1.5' radius='.15'/>
              </Shape>
              <Transform rotation='1 0 0 1.57' translation='0 -.75 0'>
                <Shape>
                  <Box size='.5 .5 .01'/>
                  <Appearance>
                    <Material diffuseColor='.9 .9 .9' shininess='1'/>
                  </Appearance>
                </Shape>
              </Transform>
              <Transform DEF='NetTransform'>
                <IS>
                  <connect nodeField='scale' protoField='netScale'/>
                  <connect nodeField='rotation' protoField='netOrientation'/>
                </IS>
                <Transform DEF='NettingTransform' rotation='0 1 0 1.57' scale='.01 .01 .01' translation='0 0 1'>
                  <IS>
                    <connect nodeField='scale' protoField='nettingScale'/>
                  </IS>
                </Transform>
              </Transform>
            </Transform>
            <Transform DEF='StbdTubeTransform' translation='-.3 0 0'>
              <Transform rotation='1 0 0 -.78'>
                <Shape>
                  <Appearance>
                    <Material diffuseColor='.9 .9 .9' shininess='1'/>
                  </Appearance>
                  <Cylinder height='1.5' radius='.15'/>
                </Shape>
                <Transform rotation='1 0 0 -1.57' translation='0 -.75 0'>
                  <Shape>
                    <Appearance>
                      <Material diffuseColor='.9 .9 .9' shininess='1'/>
                    </Appearance>
                    <Box size='.5 .5 .01'/>
                  </Shape>
                </Transform>
                <Transform DEF='NetTransformStbd'>
                  <Shape>
                    <Appearance>
                      <Material diffuseColor='1 0 0' shininess='1'/>
                    </Appearance>
                    <Cylinder height='1.4' radius='.12'/>
                  </Shape>
                  <Transform DEF='NettingTransformStbd' rotation='0 1 0 1.57' scale='.01 .01 .01' translation='0 0 -1'>
                    <Shape DEF='NETTING'>
                      <Appearance>
                        <Material/>
                        <ImageTexture DEF='grill' url='"grill.png" "../../Weapons/Guns/grill.png" "../../../Weapons/Guns/grill.png" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter18-TextureMapping/grill.png"'/>
                        <TextureTransform center='0.5 0.5' scale='32 8'/>
                      </Appearance>
                      <IndexedFaceSet DEF='Screen' coordIndex='0 1 2 3' solid='false' texCoordIndex='0 1 2 3'>
                        <Coordinate point='-1 -.4 0.1 1 -.4 0.1 1 .4 .1 -1 .4 .1'/>
                        <TextureCoordinate point='0 0 1 0 1 1 0 1'/>
                      </IndexedFaceSet>
                    </Shape>
                  </Transform>
                </Transform>
              </Transform>
            </Transform>
            <Transform translation='-.2 -.75 0'>
              <Shape>
                <Box size='1.5 .2 1.5'/>
                <Appearance>
                  <Material diffuseColor='.4 .4 .4' shininess='1'/>
                </Appearance>
              </Shape>
            </Transform>
          </Transform>
          <ROUTE fromField='fraction_changed' fromNode='NetPositClock' toField='set_fraction' toNode='NetPositInterp'/>
          <ROUTE fromField='fraction_changed' fromNode='NetPositClock' toField='set_fraction' toNode='NetOrientInterp'/>
          <ROUTE fromField='fraction_changed' fromNode='NetPositClock' toField='set_fraction' toNode='NetPositScale'/>
          <ROUTE fromField='fraction_changed' fromNode='NetPositClock' toField='set_fraction' toNode='NettingScale'/>
          <ROUTE fromField='fraction_changed' fromNode='NetPositClockStbd' toField='set_fraction' toNode='NetPositScaleStbd'/>
          <ROUTE fromField='fraction_changed' fromNode='NetPositClockStbd' toField='set_fraction' toNode='NetPositInterpStbd'/>
          <ROUTE fromField='fraction_changed' fromNode='NetPositClockStbd' toField='set_fraction' toNode='NetOrientInterpStbd'/>
          <ROUTE fromField='fraction_changed' fromNode='NetPositClockStbd' toField='set_fraction' toNode='NettingScaleStbd'/>
          <ROUTE fromField='value_changed' fromNode='NetPositInterp' toField='set_translation' toNode='NetTransform'/>
          <ROUTE fromField='value_changed' fromNode='NetOrientInterp' toField='set_rotation' toNode='NetTransform'/>
          <ROUTE fromField='value_changed' fromNode='NetPositScale' toField='scale' toNode='NetTransform'/>
          <ROUTE fromField='value_changed' fromNode='NettingScale' toField='set_scale' toNode='NettingTransform'/>
          <ROUTE fromField='value_changed' fromNode='NettingScaleStbd' toField='set_scale' toNode='NettingTransformStbd'/>
          <ROUTE fromField='value_changed' fromNode='NetPositInterpStbd' toField='set_translation' toNode='NetTransformStbd'/>
          <ROUTE fromField='value_changed' fromNode='NetOrientInterpStbd' toField='set_rotation' toNode='NetTransformStbd'/>
          <ROUTE fromField='value_changed' fromNode='NetPositScaleStbd' toField='scale' toNode='NetTransformStbd'/>
        </Group>
      </ProtoBody>
    </ProtoDeclare>
    <ProtoInstance DEF='myLauncher' name='NetLauncher'/>
    <TouchSensor DEF='myTouch' description='touch to activate'/>
    <ROUTE fromField='touchTime' fromNode='myTouch' toField='startLaunchToStbd' toNode='myLauncher'/>
    <Transform translation='0 -1 0'>
      <Shape DEF='TestWater'>
        <Appearance>
          <Material diffuseColor='0 0 1'/>
        </Appearance>
        <Box size='150 .1 150'/>
      </Shape>
    </Transform>
    <Transform rotation='1 0 0 .78'>
      <Transform DEF='FinalNetTransform' scale='.01 .01 .01'>
        <Shape>
          <Appearance>
            <Material diffuseColor='1 0 0' shininess='1'/>
          </Appearance>
          <Cylinder height='1.4' radius='.12'/>
        </Shape>
        <Transform DEF='FinalNettingTransform' rotation='0 1 0 1.57' scale='.01 .01 .01' translation='0 0 1'>
          <!-- note can't DEF/USE nodes from within ProtoDeclare to parent scene -->
          <Shape DEF='FinalNETTING'>
            <Appearance>
              <Material/>
              <ImageTexture url='"grill.png" "../../../Weapons/Guns/grill.png" "../../Weapons/Guns/grill.png" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter18-TextureMapping/grill.png"'/>
              <TextureTransform center='0.5 0.5' scale='32 8'/>
            </Appearance>
            <IndexedFaceSet DEF='FinalScreen' coordIndex='0 1 2 3' solid='false' texCoordIndex='0 1 2 3'>
              <Coordinate point='-1 -.4 0.1 1 -.4 0.1 1 .4 .1 -1 .4 .1'/>
              <TextureCoordinate point='0 0 1 0 1 1 0 1'/>
            </IndexedFaceSet>
          </Shape>
        </Transform>
      </Transform>
    </Transform>
    <ROUTE fromField='netTranslation' fromNode='myLauncher' toField='set_translation' toNode='FinalNetTransform'/>
    <ROUTE fromField='netScale' fromNode='myLauncher' toField='set_scale' toNode='FinalNetTransform'/>
    <ROUTE fromField='nettingScale' fromNode='myLauncher' toField='set_scale' toNode='FinalNettingTransform'/>
    <ROUTE fromField='netOrientation' fromNode='myLauncher' toField='set_rotation' toNode='FinalNetTransform'/>
  </Scene>
</X3D>