<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<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 ' >
<head>
<meta name='titlecontent=' PongGame.x3d '/>
<meta name='descriptioncontent='12 Second Simulation Of The Game Pong'/>
<meta name='creatorcontent='Nicholas Hittner'/>
<meta name='createdcontent='19 July 2021'/>
<meta name='modifiedcontent='26 August 2023'/>
<meta name='Soundcontent='pong.wav'/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/PongGame.x3d '/>
<meta name='generatorcontent='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo info='"PongSimulation"title='Pong'/>
<Viewpoint description='Pong'/>

<!-- ROUTE information for SquareBall node:  [from SquareBallPosition.value_changed to set_translation ] -->
<Transform DEF='SquareBalltranslation='.5 .5 0'>
<Shape>
<Rectangle2D size='.3 .3'/>
<Appearance>
<Material diffuseColor='0.9 0.9 0.9'/>
</Appearance>
</Shape>
</Transform>
<!-- 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'/>

< ROUTE  fromNode=' SquareBallPosition' fromField='value_changed' toNode=' SquareBall' toField='set_translation'/>
< ROUTE  fromNode=' SceneClock' fromField='fraction_changed' toNode=' SquareBallPosition' toField='set_fraction'/>
<!-- ROUTE information for RightPaddle node:  [from RightPaddlePosition.value_changed to set_translation ] -->
<Transform DEF='RightPaddletranslation='2.8 .5 0'>
<Shape>
<Rectangle2D size='.2 1.2'/>
<Appearance>
<Material diffuseColor='0.9 0.9 0.9'/>
</Appearance>
</Shape>
</Transform>
<!-- 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'/>

< ROUTE  fromNode=' RightPaddlePosition' fromField='value_changed' toNode=' RightPaddle' toField='set_translation'/>
< ROUTE  fromNode=' SceneClock' fromField='fraction_changed' toNode=' RightPaddlePosition' toField='set_fraction'/>
<!-- ROUTE information for LeftPaddle node:  [from LeftPaddlePosition.value_changed to set_translation ] -->
<Transform DEF='LeftPaddletranslation='-2.8 -.5 0'>
<Shape>
<Rectangle2D size='.2 1.2'/>
<Appearance>
<Material diffuseColor='0.9 0.9 0.9'/>
</Appearance>
</Shape>
</Transform>
<!-- 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'/>

< ROUTE  fromNode=' LeftPaddlePosition' fromField='value_changed' toNode=' LeftPaddle' toField='set_translation'/>
< ROUTE  fromNode=' SceneClock' fromField='fraction_changed' toNode=' LeftPaddlePosition' toField='set_fraction'/>
<Transform DEF='TriggerBackgroundtranslation='0 0 -8'>
<!-- ROUTE information for GameTouched node:  [from isActive to GameTrigger.set_boolean ] -->
<TouchSensor DEF='GameToucheddescription='touch to activate'/>

<Shape>
<Appearance>
<Material diffuseColor='0 0 0'/>
</Appearance>
<Rectangle2D size='14 14'/>
</Shape>
</Transform>
<!-- ROUTE information for GameTrigger node:  [from GameTouched.isActive to set_boolean ] [from triggerTime to SceneClock.startTime ] -->
<TimeTrigger DEF='GameTrigger'/>

< ROUTE  fromNode=' GameTouched' fromField='isActive' toNode=' GameTrigger' toField='set_boolean'/>
< ROUTE  fromNode=' GameTrigger' fromField='triggerTime' toNode=' SceneClock' toField='startTime'/>
<Transform translation='0 0 -1'>
<Shape DEF='MidLine'>
<IndexedLineSet coordIndex='0 1 0 1'>
<Coordinate point='0 3.72 -1 0 -3.72 -1'/>
</IndexedLineSet>
<Appearance>
<Material emissiveColor='1 1 1'/>
<LineProperties DEF='DashedLinelinetype='2linewidthScaleFactor='3containerField='lineProperties'/>
</Appearance>
</Shape>
</Transform>
<Transform>
<Shape DEF='TopLine'>
<IndexedLineSet coordIndex='0 1 0 1'>
<Coordinate point='-3.5 3.4 -1 3.5 3.4 -1'/>
</IndexedLineSet>
<Appearance>
<Material emissiveColor='1 1 1'/>
<LineProperties linewidthScaleFactor='5containerField='lineProperties'/>
</Appearance>
</Shape>
</Transform>
<Transform>
<Shape DEF='BottomLine'>
<IndexedLineSet coordIndex='0 1 0 1'>
<Coordinate point='-3.5 -3.4 -1 3.5 -3.4 -1'/>
</IndexedLineSet>
<Appearance>
<Material emissiveColor='1 1 1'/>
<LineProperties linewidthScaleFactor='5containerField='lineProperties'/>
</Appearance>
</Shape>
</Transform>
<Transform DEF='LeftScoretranslation='-.7 3 0'>
<Shape>
<Text string='"0"'>
<FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"style='BOLD'/>
</Text>
<Appearance>
<Material diffuseColor='0.9 0.9 0.9'/>
</Appearance>
</Shape>
</Transform>
<Transform DEF='RightScoretranslation='.7 3 0'>
<!-- 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'/>

<!-- ROUTE information for GoalScored node:  [from ScoreSequencer.value_changed to whichChoice ] -->
<Switch DEF='GoalScoredwhichChoice='0'>
<Shape DEF='Child0'>
<Text string='"0"'>
<FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"style='BOLD'/>
</Text>
<Appearance>
<Material diffuseColor='0.9 0.9 0.9'/>
</Appearance>
</Shape>
<Shape DEF='Child1'>
<Text string='"1"'>
<FontStyle family='"SANS"justify='"MIDDLE" "MIDDLE"style='BOLD'/>
</Text>
<Appearance>
<Material diffuseColor='0.9 0.9 0.9'/>
</Appearance>
</Shape>
</Switch>
</Transform>
< ROUTE  fromNode=' SceneClock' fromField='fraction_changed' toNode=' ScoreSequencer' toField='set_fraction'/>
< ROUTE  fromNode=' ScoreSequencer' fromField='value_changed' toNode=' GoalScored' toField='whichChoice'/>
<Sound direction='0 -0.19612 -0.98058location='0 1 0maxBack='100maxFront='100minBack='20minFront='20priority='1spatialize='false'>
<!-- 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" ' />
</Sound>
< ROUTE  fromNode=' SceneClock' fromField='startTime' toNode=' PongAudio' toField='startTime'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- 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
-->

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



-->

<!-- 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. -->