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='title' content='PongGame.x3d'/> |
6 | <meta name='description' content='12 Second Simulation Of The Game Pong'/> |
7 | <meta name='creator' content='Nicholas Hittner'/> |
8 | <meta name='created' content='19 July 2021'/> |
9 | <meta name='modified' content='26 August 2023'/> |
10 | <meta name='Sound' content='pong.wav'/> |
11 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/PongGame.x3d'/> |
12 | <meta name='generator' content='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/> |
13 | <meta name='license' content='../license.html'/> |
14 | </head> |
15 | <Scene> |
16 | <WorldInfo info='"PongSimulation"' title='Pong'/> |
17 | <Viewpoint description='Pong'/> |
18 |
<!-- ROUTE information for SceneClock node:
[from GameTrigger.triggerTime to startTime
]
[from fraction_changed to SquareBallPosition.set_fraction
]
[from fraction_changed to RightPaddlePosition.set_fraction
]
[from fraction_changed to LeftPaddlePosition.set_fraction
]
[from fraction_changed to ScoreSequencer.set_fraction
]
[from startTime to PongAudio.startTime
]
-->
<TimeSensor DEF='SceneClock' cycleInterval='12'/> |
19 |
<!-- ROUTE information for SquareBall node:
[from SquareBallPosition.value_changed to set_translation
]
-->
<Transform DEF='SquareBall' translation='.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='SquareBallPosition' key='0 0.1667 0.25 0.5 0.6667 0.7 1' keyValue='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='RightPaddle' translation='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='RightPaddlePosition' key='0 0.1667 0.3333 0.5 0.6667 0.8333 1' keyValue='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='LeftPaddle' translation='-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='LeftPaddlePosition' key='0 0.1667 0.3333 0.5 0.6667 0.8333 1' keyValue='-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='TriggerBackground' translation='0 0 -8'> |
53 |
<!-- ROUTE information for GameTouched node:
[from isActive to GameTrigger.set_boolean
]
-->
<TouchSensor DEF='GameTouched' description='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='DashedLine' linetype='2' linewidthScaleFactor='3' containerField='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='5' containerField='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='5' containerField='lineProperties'/> |
94 | </Appearance> |
95 | </Shape> |
96 | </Transform> |
97 | <Transform DEF='LeftScore' translation='-.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='RightScore' translation='.7 3 0'> |
108 |
<!-- ROUTE information for ScoreSequencer node:
[from SceneClock.fraction_changed to set_fraction
]
[from value_changed to GoalScored.whichChoice
]
-->
<IntegerSequencer DEF='ScoreSequencer' key='0.01 0.99' keyValue='0 1'/> |
109 |
<!-- ROUTE information for GoalScored node:
[from ScoreSequencer.value_changed to whichChoice
]
-->
<Switch DEF='GoalScored' whichChoice='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.98058' location='0 1 0' maxBack='100' maxFront='100' minBack='20' minFront='20' priority='1' spatialize='false'> |
131 |
<!-- ROUTE information for PongAudio node:
[from SceneClock.startTime to startTime
]
-->
<AudioClip DEF='PongAudio' description='AudioClip' stopTime='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 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.
<!--
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)
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->