X3D Model Documentation: RifleM24Example.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <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'>
  4       <head>
  5            <meta name='title' content='RifleM24Example.x3d'/>
  6            <meta name='description' content='Animation example from RifleM24 Prototype. Clicking trigger fires and sound.'/>
  7            <meta name='creator' content='Etsuko Lippi'/>
  8            <meta name='created' content='31 Decmember 2001'/>
  9            <meta name='modified' content='28 November 2019'/>
 10            <meta name='generator' content='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
 11            <meta name='identifier' content='https://savage.nps.edu/Savage/Weapons/SmallArms/RifleM24Example.x3d'/>
 12            <meta name='subject' content='Rifle M24'/>
 13            <meta name='license' content='../../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: About, AboutRifleM24, FireScript, FireTouchSensor, rifleM24, Target

Index for ExternProtoDeclare definition: RifleM24
-->
 15       <Scene>
 16            <WorldInfo title='RifleM24Example.x3d'/>
 17            <ExternProtoDeclare name='RifleM24' appinfo='Rifle M24'   url=' "RifleM24Prototype.x3d#RifleM24" "https://savage.nps.edu/Savage/Weapons/SmallArms/RifleM24Prototype.x3d#RifleM24" "RifleM24Prototype.wrl#RifleM24" "https://savage.nps.edu/Savage/Weapons/SmallArms/RifleM24Prototype.wrl#RifleM24" '>
 18                 <field name='trigger' type='SFBool' accessType='inputOnly'
                appinfo='input true to fire'/>
 19                 <field name='fire' type='SFBool' accessType='outputOnly'
                appinfo='output true when fired'/>
 20                 <field name='animationStartTime' type='SFTime' accessType='inputOnly'
                appinfo='trigger animation'/>
 21            </ExternProtoDeclare>
 22            <Background skyColor='0.604 0.753 0.804'/>
 23            <Group>
 24 
               <!-- ROUTE information for rifleM24 node:  [from FireTouchSensor.touchTime to animationStartTime ] [from FireScript.fire to trigger ] -->
               <ProtoInstance name='RifleM24' DEF='rifleM24'/>
 25 
               <!-- ROUTE information for FireScript node:  [from FireTouchSensor.isOver to enabled ] [from fire to rifleM24.trigger ] -->
               <Script DEF='FireScript'>
 26                      <field name='fire' type='SFBool' accessType='outputOnly'/>
 27                      <field name='enabled' type='SFBool' accessType='inputOnly'/>
  <![CDATA[
        
ecmascript:

function enabled (value, timeStamp)
{
        //print ('enabled value =' + value);
        if (value == true)
           fire = value;
}

      
]]>
 29                 </Script>
 30 
               <!-- ROUTE information for FireTouchSensor node:  [from isOver to FireScript.enabled ] [from touchTime to rifleM24.animationStartTime ] -->
               <TouchSensor DEF='FireTouchSensor' description='click to shoot'/>
 31                 < ROUTE  fromNode='FireTouchSensor' fromField='isOver' toNode='FireScript' toField='enabled'/>
 32                 < ROUTE  fromNode='FireTouchSensor' fromField='touchTime' toNode='rifleM24' toField='animationStartTime'/>
 33                 < ROUTE  fromNode='FireScript' fromField='fire' toNode='rifleM24' toField='trigger'/>
 34            </Group>
 35            <Transform DEF='Target' rotation='0.58 0.58 0.58 2.09' translation='50 -1 0'>
 36                 <Shape>
 37                      <Appearance>
 38                           <Material/>
 39                           <ImageTexture   url=' "Target.gif " "Target.jpg " "https://savage.nps.edu/Savage/Weapons/SmallArms/Target.gif " "https://savage.nps.edu/Savage/Weapons/SmallArms/Target.jpg " '/>
 40                      </Appearance>
 41                      <IndexedFaceSet creaseAngle='1.75' solid='false' coordIndex='0 1 2 3 0'>
 42                           <Coordinate point='0.00 1.30 0 2.5 1.30 0 2.5 -1.30 0 0.00 -1.30 0'/>
 43                      </IndexedFaceSet>
 44                 </Shape>
 45            </Transform>
 46            <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" '>
 47                 <Transform DEF='AboutRifleM24' translation='-0.5 -0.4 -0.3'>
 48                      <Shape>
 49                           <Appearance>
 50                                <Material diffuseColor='0 0 0.545'/>
 51                           </Appearance>
 52                           <Text string='"About RifleM24"'>
 53                                <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.25' style='BOLD'/>
 54                           </Text>
 55                      </Shape>
 56                 </Transform>
 57            </Anchor>
 58       </Scene>
 59  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: About, AboutRifleM24, FireScript, FireTouchSensor, rifleM24, Target

Index for ExternProtoDeclare definition: RifleM24
-->
X3D Tooltips element index: Anchor, Appearance, Background, Coordinate, ExternProtoDeclare, field, FontStyle, Group, head, ImageTexture, IndexedFaceSet, Material, meta, ProtoInstance, ROUTE, Scene, Script, Shape, Text, TouchSensor, Transform, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table entries with 3 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.

FireTouchSensor
TouchSensor
isOver
SFBool
→
ROUTE
event to
(1)
FireScript
Script
enabled
SFBool
then
 
 
 
FireScript
Script
fire
SFBool
→
ROUTE
event to
(2)
rifleM24
ProtoInstance
trigger
SFBool
FireTouchSensor
TouchSensor
touchTime
SFTime
→
ROUTE
event to
(1)
rifleM24
ProtoInstance
animationStartTime
SFTime

      rifleM24
ProtoInstance
RifleM24
No ROUTE connection found for output events from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declarations with
direct access to other nodes, and thus has potential to produce run-time animation. 

About
Anchor
description='Federation of American Scientists (FAS) page' 
User-interaction hint for this node. 

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://savage.nps.edu/Savage/Weapons/SmallArms/RifleM24ExampleIndex.html -->
<!-- Version control at
https://gitlab.nps.edu/Savage/Savage/Weapons/SmallArms/RifleM24Example.x3d -->

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idName' field='value'/> matches XML terminology <XmlElement  DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
    <ProtoInstance name='ProtoName'> <field name='fieldName'/> </ProtoInstance> -->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->