X3D Model Documentation: PongGame.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
  3  <X3D profile='Immersive' version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'>
  4       <head>
  5            <meta name='titlecontent='PongGame.x3d'/>
  6            <meta name='descriptioncontent='12 Second Simulation Of The Game Pong'/>
  7            <meta name='creatorcontent='Nicholas Hittner'/>
  8            <meta name='createdcontent='19 July 2021'/>
  9            <meta name='modifiedcontent='26 August 2023'/>
 10            <meta name='Soundcontent='pong.wav'/>
 11            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/PongGame.x3d'/>
 12            <meta name='generatorcontent='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/>
 13            <meta name='licensecontent='../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: BottomLine, Child0, Child1, DashedLine, GameTouched, GameTrigger, GoalScored, LeftPaddle, LeftPaddlePosition, LeftScore, MidLine, PongAudio, RightPaddle, RightPaddlePosition, RightScore, SceneClock, ScoreSequencer, SquareBall, SquareBallPosition, TopLine, TriggerBackground

Index for Viewpoint node: Viewpoint_1
-->
 15       <Scene>
 16            <WorldInfo info='"PongSimulation"title='Pong'/>
 17            <Viewpoint description='Pong'/>
 18 
 19 
          <!-- ROUTE information for SquareBall node:  [from SquareBallPosition.value_changed to set_translation ] -->
          <Transform DEF='SquareBalltranslation='.5 .5 0'>
 20                 <Shape>
 21                      <Rectangle2D size='.3 .3'/>
 22                      <Appearance>
 23                           <Material diffuseColor='0.9 0.9 0.9'/>
 24                      </Appearance>
 25                 </Shape>
 26            </Transform>
 27 
          <!-- ROUTE information for SquareBallPosition node:  [from SceneClock.fraction_changed to set_fraction ] [from value_changed to SquareBall.set_translation ] -->
          <PositionInterpolator DEF='SquareBallPositionkey='0 0.1667 0.25 0.5 0.6667 0.7 1keyValue='0.5 0.5 1 2.5 2 1 1.5 2.5 1 -2.5 0 1 2 -2.5 1 2.5 -2 1 -2.8 2.3 1'/>
 28            < ROUTE  fromNode='SquareBallPosition' fromField='value_changed' toNode='SquareBall' toField='set_translation'/>
 29            < ROUTE  fromNode='SceneClock' fromField='fraction_changed' toNode='SquareBallPosition' toField='set_fraction'/>
 30 
          <!-- ROUTE information for RightPaddle node:  [from RightPaddlePosition.value_changed to set_translation ] -->
          <Transform DEF='RightPaddletranslation='2.8 .5 0'>
 31                 <Shape>
 32                      <Rectangle2D size='.2 1.2'/>
 33                      <Appearance>
 34                           <Material diffuseColor='0.9 0.9 0.9'/>
 35                      </Appearance>
 36                 </Shape>
 37            </Transform>
 38 
          <!-- ROUTE information for RightPaddlePosition node:  [from SceneClock.fraction_changed to set_fraction ] [from value_changed to RightPaddle.set_translation ] -->
          <PositionInterpolator DEF='RightPaddlePositionkey='0 0.1667 0.3333 0.5 0.6667 0.8333 1keyValue='2.8 0.5 1 2.8 2 1 2.8 0 1 2.8 1 1 2.8 -2 1 2.8 -2 1 2.8 0 1'/>
 39            < ROUTE  fromNode='RightPaddlePosition' fromField='value_changed' toNode='RightPaddle' toField='set_translation'/>
 40            < ROUTE  fromNode='SceneClock' fromField='fraction_changed' toNode='RightPaddlePosition' toField='set_fraction'/>
 41 
          <!-- ROUTE information for LeftPaddle node:  [from LeftPaddlePosition.value_changed to set_translation ] -->
          <Transform DEF='LeftPaddletranslation='-2.8 -.5 0'>
 42                 <Shape>
 43                      <Rectangle2D size='.2 1.2'/>
 44                      <Appearance>
 45                           <Material diffuseColor='0.9 0.9 0.9'/>
 46                      </Appearance>
 47                 </Shape>
 48            </Transform>
 49 
          <!-- ROUTE information for LeftPaddlePosition node:  [from SceneClock.fraction_changed to set_fraction ] [from value_changed to LeftPaddle.set_translation ] -->
          <PositionInterpolator DEF='LeftPaddlePositionkey='0 0.1667 0.3333 0.5 0.6667 0.8333 1keyValue='-2.8 0.5 1 -2.8 1 1 -2.8 -1 1 -2.8 0 1 -2.8 -1 1 -2.8 -2 1 -2.8 1 1'/>
 50            < ROUTE  fromNode='LeftPaddlePosition' fromField='value_changed' toNode='LeftPaddle' toField='set_translation'/>
 51            < ROUTE  fromNode='SceneClock' fromField='fraction_changed' toNode='LeftPaddlePosition' toField='set_fraction'/>
 52            <Transform DEF='TriggerBackgroundtranslation='0 0 -8'>
 53 
               <!-- ROUTE information for GameTouched node:  [from isActive to GameTrigger.set_boolean ] -->
               <TouchSensor DEF='GameToucheddescription='touch to activate'/>
 54                 <Shape>
 55                      <Appearance>
 56                           <Material diffuseColor='0 0 0'/>
 57                      </Appearance>
 58                      <Rectangle2D size='14 14'/>
 59                 </Shape>
 60            </Transform>
 61 
          <!-- ROUTE information for GameTrigger node:  [from GameTouched.isActive to set_boolean ] [from triggerTime to SceneClock.startTime ] -->
          <TimeTrigger DEF='GameTrigger'/>
 62            < ROUTE  fromNode='GameTouched' fromField='isActive' toNode='GameTrigger' toField='set_boolean'/>
 63            < ROUTE  fromNode='GameTrigger' fromField='triggerTime' toNode='SceneClock' toField='startTime'/>
 64            <Transform translation='0 0 -1'>
 65                 <Shape DEF='MidLine'>
 66                      <IndexedLineSet coordIndex='0 1 0 1'>
 67                           <Coordinate point='0 3.72 -1 0 -3.72 -1'/>
 68                      </IndexedLineSet>
 69                      <Appearance>
 70                           <Material emissiveColor='1 1 1'/>
 71                           <LineProperties DEF='DashedLinelinetype='2linewidthScaleFactor='3containerField='lineProperties'/>
 72                      </Appearance>
 73                 </Shape>
 74            </Transform>
 75            <Transform>
 76                 <Shape DEF='TopLine'>
 77                      <IndexedLineSet coordIndex='0 1 0 1'>
 78                           <Coordinate point='-3.5 3.4 -1 3.5 3.4 -1'/>
 79                      </IndexedLineSet>
 80                      <Appearance>
 81                           <Material emissiveColor='1 1 1'/>
 82                           <LineProperties linewidthScaleFactor='5containerField='lineProperties'/>
 83                      </Appearance>
 84                 </Shape>
 85            </Transform>
 86            <Transform>
 87                 <Shape DEF='BottomLine'>
 88                      <IndexedLineSet coordIndex='0 1 0 1'>
 89                           <Coordinate point='-3.5 -3.4 -1 3.5 -3.4 -1'/>
 90                      </IndexedLineSet>
 91                      <Appearance>
 92                           <Material emissiveColor='1 1 1'/>
 93                           <LineProperties linewidthScaleFactor='5containerField='lineProperties'/>
 94                      </Appearance>
 95                 </Shape>
 96            </Transform>
 97            <Transform DEF='LeftScoretranslation='-.7 3 0'>
 98                 <Shape>
 99                      <Text string='"0"'>
100                           <FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"style='BOLD'/>
101                      </Text>
102                      <Appearance>
103                           <Material diffuseColor='0.9 0.9 0.9'/>
104                      </Appearance>
105                 </Shape>
106            </Transform>
107            <Transform DEF='RightScoretranslation='.7 3 0'>
108 
               <!-- ROUTE information for ScoreSequencer node:  [from SceneClock.fraction_changed to set_fraction ] [from value_changed to GoalScored.whichChoice ] -->
               <IntegerSequencer DEF='ScoreSequencerkey='0.01 0.99keyValue='0 1'/>
109 
               <!-- ROUTE information for GoalScored node:  [from ScoreSequencer.value_changed to whichChoice ] -->
               <Switch DEF='GoalScoredwhichChoice='0'>
110                      <Shape DEF='Child0'>
111                           <Text string='"0"'>
112                                <FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"style='BOLD'/>
113                           </Text>
114                           <Appearance>
115                                <Material diffuseColor='0.9 0.9 0.9'/>
116                           </Appearance>
117                      </Shape>
118                      <Shape DEF='Child1'>
119                           <Text string='"1"'>
120                                <FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"style='BOLD'/>
121                           </Text>
122                           <Appearance>
123                                <Material diffuseColor='0.9 0.9 0.9'/>
124                           </Appearance>
125                      </Shape>
126                 </Switch>
127            </Transform>
128            < ROUTE  fromNode='SceneClock' fromField='fraction_changed' toNode='ScoreSequencer' toField='set_fraction'/>
129            < ROUTE  fromNode='ScoreSequencer' fromField='value_changed' toNode='GoalScored' toField='whichChoice'/>
130            <Sound direction='0 -0.19612 -0.98058location='0 1 0maxBack='100maxFront='100minBack='20minFront='20priority='1spatialize='false'>
131 
               <!-- ROUTE information for PongAudio node:  [from SceneClock.startTime to startTime ] -->
               <AudioClip DEF='PongAudiodescription='AudioClipstopTime='12'   url=' "pong.wav" "https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/pong.wav" '/>
132            </Sound>
133            < ROUTE  fromNode='SceneClock' fromField='startTime' toNode='PongAudio' toField='startTime'/>
134       </Scene>
135  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: BottomLine, Child0, Child1, DashedLine, GameTouched, GameTrigger, GoalScored, LeftPaddle, LeftPaddlePosition, LeftScore, MidLine, PongAudio, RightPaddle, RightPaddlePosition, RightScore, SceneClock, ScoreSequencer, SquareBall, SquareBallPosition, TopLine, TriggerBackground

Index for Viewpoint node: Viewpoint_1
-->
X3D Tooltips element index: Appearance, AudioClip, Coordinate, FontStyle, head, IndexedLineSet, IntegerSequencer, LineProperties, Material, meta, PositionInterpolator, Rectangle2D, ROUTE, Scene, Shape, Sound, Switch, Text, TimeSensor, TimeTrigger, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

Event Graph ROUTE Table entries with 11 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.

GameTouched
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
GameTrigger
TimeTrigger
set_boolean
SFBool
then
 
 
 
GameTrigger
TimeTrigger
triggerTime
SFTime

ROUTE
event to
(2)
SceneClock
TimeSensor
startTime
SFTime
then
 
 
 
SceneClock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(3)
SquareBallPosition
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
SquareBallPosition
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(4)
SquareBall
Transform
set_translation
SFVec3f
  then
 
 
 
SceneClock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(3)
RightPaddlePosition
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
RightPaddlePosition
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(4)
RightPaddle
Transform
set_translation
SFVec3f
  then
 
 
 
SceneClock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(3)
LeftPaddlePosition
PositionInterpolator
set_fraction
SFFloat
then
 
 
 
LeftPaddlePosition
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(4)
LeftPaddle
Transform
set_translation
SFVec3f
  then
 
 
 
SceneClock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(3)
ScoreSequencer
IntegerSequencer
set_fraction
SFFloat
then
 
 
 
ScoreSequencer
IntegerSequencer
value_changed
SFInt32

ROUTE
event to
(4)
GoalScored
Switch
whichChoice
SFInt32
  then
 
 
 
SceneClock
TimeSensor
startTime
SFTime

ROUTE
event to
(3)
PongAudio
AudioClip
startTime
SFTime

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://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/PongGameIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/PongGame.x3d -->

<!-- Color 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)
-->

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