<?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='RifleM24Example.x3d' name='title'/>
    <meta content='Animation example from RifleM24 Prototype. Clicking trigger fires and sound.' name='description'/>
    <meta content='Etsuko Lippi' name='creator'/>
    <meta content='31 Decmember 2001' name='created'/>
    <meta content='28 November 2019' name='modified'/>
    <meta content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='https://www.web3d.org/x3d/content/examples/Savage/Weapons/SmallArms/RifleM24Example.x3d' name='identifier'/>
    <meta content='Rifle M24' name='subject'/>
    <meta content='../../license.html' name='license'/>
  </head>
  <Scene>
    <WorldInfo title='RifleM24Example.x3d'/>
    <ExternProtoDeclare appinfo='Rifle M24' name='RifleM24' url='"RifleM24Prototype.x3d#RifleM24" "https://www.web3d.org/x3d/content/examples/Savage/Weapons/SmallArms/RifleM24Prototype.x3d#RifleM24" "RifleM24Prototype.wrl#RifleM24" "https://www.web3d.org/x3d/content/examples/Savage/Weapons/SmallArms/RifleM24Prototype.wrl#RifleM24"'>
      <field accessType='inputOnly' appinfo='input true to fire' name='trigger' type='SFBool'/>
      <field accessType='outputOnly' appinfo='output true when fired' name='fire' type='SFBool'/>
      <field accessType='inputOnly' appinfo='trigger animation' name='animationStartTime' type='SFTime'/>
    </ExternProtoDeclare>
    <Background skyColor='0.604 0.753 0.804'/>
    <Group>
      <ProtoInstance DEF='rifleM24' name='RifleM24'/>
      <Script DEF='FireScript'>
        <field accessType='outputOnly' name='fire' type='SFBool'/>
        <field accessType='inputOnly' name='enabled' type='SFBool'/>
        <![CDATA[
ecmascript:

function enabled (value, timeStamp)
{
        //print ('enabled value =' + value);
        if (value == true)
           fire = value;
}
]]>
      </Script>
      <TouchSensor DEF='FireTouchSensor' description='click to shoot'/>
      <ROUTE fromField='isOver' fromNode='FireTouchSensor' toField='enabled' toNode='FireScript'/>
      <ROUTE fromField='touchTime' fromNode='FireTouchSensor' toField='animationStartTime' toNode='rifleM24'/>
      <ROUTE fromField='fire' fromNode='FireScript' toField='trigger' toNode='rifleM24'/>
    </Group>
    <Transform DEF='Target' rotation='0.58 0.58 0.58 2.09' translation='50 -1 0'>
      <Shape>
        <Appearance>
          <Material/>
          <ImageTexture url='"Target.gif" "Target.jpg" "https://www.web3d.org/x3d/content/examples/Savage/Weapons/SmallArms/Target.gif" "https://www.web3d.org/x3d/content/examples/Savage/Weapons/SmallArms/Target.jpg"'/>
        </Appearance>
        <IndexedFaceSet coordIndex='0 1 2 3 0' creaseAngle='1.75' solid='false'>
          <Coordinate point='0.00 1.30 0 2.5 1.30 0 2.5 -1.30 0 0.00 -1.30 0'/>
        </IndexedFaceSet>
      </Shape>
    </Transform>
    <Anchor DEF='About' description='Federation of American Scientists (FAS) page' parameter='"target=_blank"' url='"https://www.fas.org/man/dod-101/sys/land/m14.htm"'>
      <Transform DEF='AboutRifleM24' translation='-0.5 -0.4 -0.3'>
        <Shape>
          <Appearance>
            <Material diffuseColor='0 0 0.545'/>
          </Appearance>
          <Text string='"About RifleM24"'>
            <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.25' style='BOLD'/>
          </Text>
        </Shape>
      </Transform>
    </Anchor>
  </Scene>
</X3D>