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 | <component level='2' name='Shape'/> |
6 | <meta name='title' content=' PongGame.x3d '/> |
7 | <meta name='description' content='12 Second Simulation Of The Game Pong'/> |
8 | <meta name='creator' content='Nicholas Hittner'/> |
9 | <meta name='created' content='19 July 2021'/> |
10 | <meta name='modified' content='14 July 2025'/> |
11 | <meta name='Sound' content=' pong.wav ' /> |
12 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/PongGame.x3d '/> |
13 | <meta name='generator' content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
14 | <meta name='license' content='../license.html'/> |
15 | </head> |
16 | <Scene> |
17 | <WorldInfo info='"PongSimulation"' title='Pong'/> |
18 | <Viewpoint description='Pong'/> |
19 |
<!-- 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'/> |
20 |
<!-- ROUTE information for SquareBall node:
[from SquareBallPosition.value_changed to set_translation
]
-->
<Transform DEF='SquareBall' translation='.5 .5 0'> |
21 | <Shape> |
22 | <Rectangle2D size='.3 .3'/> |
23 | <Appearance> |
24 | <Material diffuseColor='0.9 0.9 0.9'/> |
25 | </Appearance> |
26 | </Shape> |
27 | </Transform> |
28 |
<!-- 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'/> |
29 | < ROUTE fromNode='SquareBallPosition' fromField='value_changed' toNode='SquareBall' toField='set_translation'/> |
30 | < ROUTE fromNode='SceneClock' fromField='fraction_changed' toNode='SquareBallPosition' toField='set_fraction'/> |
31 |
<!-- ROUTE information for RightPaddle node:
[from RightPaddlePosition.value_changed to set_translation
]
-->
<Transform DEF='RightPaddle' translation='2.8 .5 0'> |
32 | <Shape> |
33 | <Rectangle2D size='.2 1.2'/> |
34 | <Appearance> |
35 | <Material diffuseColor='0.9 0.9 0.9'/> |
36 | </Appearance> |
37 | </Shape> |
38 | </Transform> |
39 |
<!-- 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'/> |
40 | < ROUTE fromNode='RightPaddlePosition' fromField='value_changed' toNode='RightPaddle' toField='set_translation'/> |
41 | < ROUTE fromNode='SceneClock' fromField='fraction_changed' toNode='RightPaddlePosition' toField='set_fraction'/> |
42 |
<!-- ROUTE information for LeftPaddle node:
[from LeftPaddlePosition.value_changed to set_translation
]
-->
<Transform DEF='LeftPaddle' translation='-2.8 -.5 0'> |
43 | <Shape> |
44 | <Rectangle2D size='.2 1.2'/> |
45 | <Appearance> |
46 | <Material diffuseColor='0.9 0.9 0.9'/> |
47 | </Appearance> |
48 | </Shape> |
49 | </Transform> |
50 |
<!-- 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'/> |
51 | < ROUTE fromNode='LeftPaddlePosition' fromField='value_changed' toNode='LeftPaddle' toField='set_translation'/> |
52 | < ROUTE fromNode='SceneClock' fromField='fraction_changed' toNode='LeftPaddlePosition' toField='set_fraction'/> |
53 | <Transform DEF='TriggerBackground' translation='0 0 -8'> |
54 |
<!-- ROUTE information for GameTouched node:
[from isActive to GameTrigger.set_boolean
]
-->
<TouchSensor DEF='GameTouched' description='touch to activate'/> |
55 | <Shape> |
56 | <Appearance> |
57 | <Material diffuseColor='0 0 0'/> |
58 | </Appearance> |
59 | <Rectangle2D size='14 14'/> |
60 | </Shape> |
61 | </Transform> |
62 |
<!-- ROUTE information for GameTrigger node:
[from GameTouched.isActive to set_boolean
]
[from triggerTime to SceneClock.startTime
]
-->
<TimeTrigger DEF='GameTrigger'/> |
63 | < ROUTE fromNode='GameTouched' fromField='isActive' toNode='GameTrigger' toField='set_boolean'/> |
64 | < ROUTE fromNode='GameTrigger' fromField='triggerTime' toNode='SceneClock' toField='startTime'/> |
65 | <Transform translation='0 0 -1'> |
66 | <Shape DEF='MidLine'> |
67 | <IndexedLineSet coordIndex='0 1 0 1'> |
68 | <Coordinate point='0 3.72 -1 0 -3.72 -1'/> |
69 | </IndexedLineSet> |
70 | <Appearance> |
71 | <Material emissiveColor='1 1 1'/> |
72 | <LineProperties DEF='DashedLine' linetype='2' linewidthScaleFactor='3' containerField='lineProperties'/> |
73 | </Appearance> |
74 | </Shape> |
75 | </Transform> |
76 | <Transform> |
77 | <Shape DEF='TopLine'> |
78 | <IndexedLineSet coordIndex='0 1 0 1'> |
79 | <Coordinate point='-3.5 3.4 -1 3.5 3.4 -1'/> |
80 | </IndexedLineSet> |
81 | <Appearance> |
82 | <Material emissiveColor='1 1 1'/> |
83 | <LineProperties linewidthScaleFactor='5' containerField='lineProperties'/> |
84 | </Appearance> |
85 | </Shape> |
86 | </Transform> |
87 | <Transform> |
88 | <Shape DEF='BottomLine'> |
89 | <IndexedLineSet coordIndex='0 1 0 1'> |
90 | <Coordinate point='-3.5 -3.4 -1 3.5 -3.4 -1'/> |
91 | </IndexedLineSet> |
92 | <Appearance> |
93 | <Material emissiveColor='1 1 1'/> |
94 | <LineProperties linewidthScaleFactor='5' containerField='lineProperties'/> |
95 | </Appearance> |
96 | </Shape> |
97 | </Transform> |
98 | <Transform DEF='LeftScore' translation='-.7 3 0'> |
99 | <Shape> |
100 | <Text string='"0"'> |
101 | <FontStyle family='"SANS"' justify='"MIDDLE" "MIDDLE"' style='BOLD'/> |
102 | </Text> |
103 | <Appearance> |
104 | <Material diffuseColor='0.9 0.9 0.9'/> |
105 | </Appearance> |
106 | </Shape> |
107 | </Transform> |
108 | <Transform DEF='RightScore' translation='.7 3 0'> |
109 |
<!-- 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'/> |
110 |
<!-- ROUTE information for GoalScored node:
[from ScoreSequencer.value_changed to whichChoice
]
-->
<Switch DEF='GoalScored' whichChoice='0'> |
111 | <Shape DEF='Child0'> |
112 | <Text string='"0"'> |
113 | <FontStyle family='"SANS"' justify='"MIDDLE" "MIDDLE"' style='BOLD'/> |
114 | </Text> |
115 | <Appearance> |
116 | <Material diffuseColor='0.9 0.9 0.9'/> |
117 | </Appearance> |
118 | </Shape> |
119 | <Shape DEF='Child1'> |
120 | <Text string='"1"'> |
121 | <FontStyle family='"SANS"' justify='"MIDDLE" "MIDDLE"' style='BOLD'/> |
122 | </Text> |
123 | <Appearance> |
124 | <Material diffuseColor='0.9 0.9 0.9'/> |
125 | </Appearance> |
126 | </Shape> |
127 | </Switch> |
128 | </Transform> |
129 | < ROUTE fromNode='SceneClock' fromField='fraction_changed' toNode='ScoreSequencer' toField='set_fraction'/> |
130 | < ROUTE fromNode='ScoreSequencer' fromField='value_changed' toNode='GoalScored' toField='whichChoice'/> |
131 | <Sound direction='0 -0.19612 -0.98058' location='0 1 0' maxBack='100' maxFront='100' minBack='20' minFront='20' priority='1' spatialize='false'> |
132 |
<!-- 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" '/> |
133 | </Sound> |
134 | < ROUTE fromNode='SceneClock' fromField='startTime' toNode='PongAudio' toField='startTime'/> |
135 | </Scene> |
136 | </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-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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->