<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<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 ' >
<head>
<meta name='titlecontent=' Trebuchet.x3d '/>
<meta name='descriptioncontent='Working model of a 14th century Trebuchet Catapult.'/>
<meta name='creatorcontent='LT Joe Roth'/>
<meta name='createdcontent='20 June 2001'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='versioncontent='7.8'/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/Trebuchet.x3d '/>
<meta name='referencecontent=' http://trebuchet.com '/>
<meta name='referencecontent=' http://members.home.net/dimona '/>
<meta name='subjectcontent='trebuchet catapult Monty Python'/>
<meta name='referencecontent='Permission granted for use of the VRML chicken I own a copy of Monty Python and the Holy Grail I have requested permission to use for non profit use. No response received. I will use the sound clips under "Fair Use" clause of the DMCA'/>
<meta name='referencecontent=' https://www.web3d.org/WorkingGroups/media/textures/nature/leaves_5.jpg.htm '/>
<meta name='referencecontent=' http://www.revemonde.net/UniversalMedia/textures/nature/leaves_5.jpg.htm '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo title='Trebuchet.x3d'/>
<Background groundAngle='1.309 1.570796groundColor='0.1 0.1 0 0.4 0.25 0.2 0.6 0.6 0.6skyAngle='1.309 1.57079skyColor='0 0.2 0.7 0 0.5 1 1 1 1'
  backUrl=' "https://www.web3d.org/WorkingGroups/media/textures/panoramas/meadow_2_back.jpg " '
  bottomUrl=' "https://www.web3d.org/WorkingGroups/media/textures/panoramas/meadow_2_bottom.jpg " '
  frontUrl=' "https://www.web3d.org/WorkingGroups/media/textures/panoramas/meadow_2_front.jpg " '
  leftUrl=' "https://www.web3d.org/WorkingGroups/media/textures/panoramas/meadow_2_left.jpg " '
  rightUrl=' "https://www.web3d.org/WorkingGroups/media/textures/panoramas/meadow_2_right.jpg " '
  topUrl=' "https://www.web3d.org/WorkingGroups/media/textures/panoramas/meadow_2_top.jpg " ' />

<Sound maxBack='1000maxFront='1000'>
<AudioClip DEF='HolyGraildescription='HolyGrailloop='true'
  url=' holygral.mp3"http://www.nps.navy.mil/code32/vrml/holygral.mp3" ' />
</Sound>
<Shape>
<Box size='10000 1 10000'/>
<Appearance> </Appearance>
</Shape>
<Transform rotation='0 1 0 1.57scale='.5 .5 .5translation='10.5 6.5 4.5'>
<Shape>
<Appearance DEF='TextAppearance'>
<Material diffuseColor='1 0 0emissiveColor='1 1 0'/>
</Appearance>
<Text string='"Click Sling to Select Projectile"'>
<FontStyle/>
</Text>
</Shape>
</Transform>
<Transform rotation='0 1 0 1.57scale='.5 .5 .5translation='11 5.5 6'>
<!-- ROUTE information for Weight node:  [from WeightScript.whichchoice to whichChoice ] -->
<Switch DEF='WeightwhichChoice='0'>
<Group>
<Shape>
<Appearance USE=' TextAppearance'/>
<Text string='"Click Here to Change Counter Weight (50 lbs)"'/>
</Shape>
</Group>
<Group>
<Shape>
<Appearance USE=' TextAppearance'/>
<Text string='"Click Here to Change Counter Weight (500 lbs)"'/>
</Shape>
</Group>
<Group>
<Shape>
<Appearance USE=' TextAppearance'/>
<Text string='"Click Here to Change Counter Weight (1000 lbs)"'/>
</Shape>
</Group>
<Group>
<Shape>
<Appearance USE=' TextAppearance'/>
<Text string='"Click Here to Change Counter Weight (10000 lbs)"'/>
</Shape>
</Group>
</Switch>
<!-- ROUTE information for weightselector node:  [from isActive to WeightScript.set_boolean ] -->
<TouchSensor DEF='weightselectordescription='weight selector'/>

<Transform translation='8 0 0'>
<Shape>
<Box size='20 1 1'/>
<Appearance>
<Material transparency='1'/>
</Appearance>
</Shape>
</Transform>
</Transform>
<Transform rotation='0 1 0 1.57translation='10 .5 4.5'>
<Transform DEF='launchtranslation='0 2 5'>
<Billboard>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Text string='"LAUNCH"'>
<FontStyle/>
</Text>
</Shape>
<Transform translation='2 .3 0'>
<Shape>
<Box size='5 1 1'/>
<Appearance>
<Material transparency='1'/>
</Appearance>
</Shape>
</Transform>
<!-- ROUTE information for PigdogMonk node:  [from PigdogMonkScript.whichchoice to whichChoice ] -->
<Switch DEF='PigdogMonkwhichChoice='-1'>
<Group>
<Sound maxBack='1000maxFront='1000'>
<!-- ROUTE information for PigDogSound node:  [from Launch.touchTime to set_startTime ] -->
<AudioClip DEF='PigDogSounddescription='PigDogSound'
  url=' "pigdog.wav" "http://www.nps.navy.mil/code32/vrml/pigdog.wav" ' />
</Sound>
</Group>
<Group>
<Sound maxBack='1000maxFront='1000'>
<!-- ROUTE information for MonkSound node:  [from Launch.touchTime to set_startTime ] -->
<AudioClip DEF='MonkSounddescription='MonkSound'
  url=' "monks.wav" "http://www.nps.navy.mil/code32/vrml/monks.wav" ' />
</Sound>
</Group>
</Switch>
</Billboard>
</Transform>
<Transform>
<!-- ROUTE information for projectilename node:  [from LauncheeScript.whichchoice to whichChoice ] -->
<Switch DEF='projectilenamewhichChoice='0'>
<Group>
<Shape>
<Appearance USE=' TextAppearance'/>
<Text string='"Bowling Ball (10 lbs)"'>
<FontStyle size='.5'/>
</Text>
</Shape>
<Sound maxBack='1000maxFront='1000priority='1'>
<!-- ROUTE information for HolyHandGrenadeSound node:  [from LauncheeChoice.touchTime to set_startTime ] -->
<AudioClip DEF='HolyHandGrenadeSounddescription='HolyHandGrenadeSound'
  url=' "grenade.wav" "http://www.nps.navy.mil/code32/vrml/grenade.wav" ' />
</Sound>
</Group>
<Group>
<Shape>
<Appearance USE=' TextAppearance'/>
<Text string='"Cow (1000 lbs)"'>
<FontStyle size='.5'/>
</Text>
</Shape>
<Sound maxBack='1000maxFront='1000'>
<!-- ROUTE information for CowSound node:  [from LauncheeChoice.touchTime to set_startTime ] -->
<AudioClip DEF='CowSounddescription='CowSound'
  url=' "lavache.wav" "http://www.nps.navy.mil/code32/vrml/lavache.wav" ' />
</Sound>
</Group>
<Group>
<Shape>
<Appearance USE=' TextAppearance'/>
<Text string='"Chicken (5 lbs)"'>
<FontStyle size='.5'/>
</Text>
</Shape>
<Sound maxBack='1000maxFront='1000priority='1'>
<!-- ROUTE information for HamsterSound node:  [from LauncheeChoice.touchTime to set_startTime ] -->
<AudioClip DEF='HamsterSounddescription='HamsterSound'
  url=' "hamster.wav" "http://www.nps.navy.mil/code32/vrml/hamster.wav" ' />
</Sound>
</Group>
</Switch>
</Transform>
</Transform>
<Transform rotation='0 1 0 -1.67'>
<Transform DEF='afttranslation='5 5 15'>
<Transform translation='-2.5 -4.5 -2'>
<Transform USE=' launch'/>
</Transform>
</Transform>
</Transform>
<Transform translation='0 3 0'>
<Shape DEF='plank'>
<Box size='25 1 1'/>
<Appearance DEF='wood'> </Appearance>
</Shape>
<Transform DEF='angledsupportrotation='0 0 1 1translation='-5 10 0'>
<Shape USE=' plank'/>
</Transform>
<Transform DEF='angledsupport2rotation='0 0 1 -1translation='5 10 0'>
<Shape USE=' plank'/>
</Transform>
<Transform DEF='verticalsupportrotation='0 0 1 1.57scale='.9 1 1translation='0 11 0'>
<Shape USE=' plank'/>
<!-- Main Verticle Support -->
</Transform>
<Transform DEF='horizontalsupportscale='.4 1 1translation='0 10 0'>
<Shape USE=' plank'/>
</Transform>
<Transform rotation='0 0 1 1.57scale='.6 1 1translation='0 5 10'>
<Transform rotation='0 1 0 .4'>
<Shape USE=' plank'/>
</Transform>
</Transform>
<Transform DEF='paneltranslation='0 18.2 -.3'>
<Shape>
<Box size='5 5 .5'/>
<Appearance USE=' wood'/>
</Shape>
</Transform>
<Transform rotation='1 0 0 -1.57translation='0 0.6 2.5'>
<Transform rotation='0 0 1 1.57'>
<Shape>
<Extrusion beginCap='falsecrossSection='1.0 -.38 .92 -.38 .71 -.71 .38 -.92 0.0 -1.0 -.38 -.92 -.71 -.71 -.92 -.38 -1.0 -.38 -1 -1.1 1 -1.1 1.0 -.38endCap='falsesolid='falsespine='0 6 0 0 -11 0'/>
<Appearance USE=' wood'/>
</Shape>
</Transform>
</Transform>
<!-- ROUTE information for flinger node:  [from flingerangles.value_changed to set_rotation ] -->
<Transform DEF='flingercenter='7 0 0rotation='0 0 1 .82scale='.9 1 1translation='-7 18 2.5'>
<Transform>
<Shape>
<Box size='35 1 1'/>
<Appearance USE=' wood'/>
</Shape>
<Transform translation='7 0 0'>
<Shape>
<Box size='8 2 2'/>
<Appearance USE=' wood'/>
</Shape>
</Transform>
</Transform>
<Transform rotation='1 0 0 1.57scale='.2 .2 .2translation='-15 -1 0'>
<Shape DEF='Torus'>
<Appearance>
<Material specularColor='1 1 1'/>
</Appearance>
<Extrusion beginCap='falseconvex='falsecreaseAngle='1.57crossSection='.90 0.00 0.81 -0.34 0.63 -0.63 0.34 -0.83 0.00 -.9 -0.34 -0.81 -0.63 -0.63 -0.81 -0.34 -.90 -0.00 -0.81 0.34 -0.63 0.63 -0.34 0.81 0.00 .90 0.38 0.81 0.63 0.63 0.81 0.34 .90 0.00endCap='falsespine='2.00 0.0 0.00 1.85 0.0 0.77 1.41 0.0 1.41 0.77 0.0 1.85 0.00 0.0 2.00 -0.77 0.0 1.85 -1.41 0.0 1.41 -1.85 0.0 0.77 -2.00 0.0 0.00 -1.85 0.0 -0.77 -1.41 0.0 -1.41 -0.77 0.0 -1.85 0.00 0.0 -2.00 0.77 0.0 -1.85 1.41 0.0 -1.41 1.85 0.0 -0.77 2.00 0.0 0.00'/>
</Shape>
<Transform translation='1 0 2'>
<Shape>
<Appearance DEF='rope'>
<ImageTexture USE=' woodTexture'/>
</Appearance>
<Sphere radius='1.5'/>
</Shape>
<!-- knott -->
</Transform>
</Transform>
<!-- The Unicorn -->
<Transform rotation='0 0 1 1.2scale='.2 .2 .2translation='-18.3 0.3 0'>
<Shape>
<Cylinder height='10'/>
<Appearance>
<Material specularColor='1 1 1'/>
</Appearance>
</Shape>
<Transform translation='0 -2.5 0'>
<Shape USE=' Torus'/>
<!-- The Unicorn -->
<Transform translation='-2 -0 0'>
<Shape>
<Sphere radius='1.5'/>
<Appearance USE=' rope'/>
</Shape>
<!-- Knott -->
</Transform>
</Transform>
<Transform rotation='0 0 1 1.2translation='15 55 -11'>
<Transform scale='5 5 5'>
<Shape>
<Appearance USE=' rope'/>
<Extrusion beginCap='falsecreaseAngle='0.76crossSection='.100 0.00 0.092 -0.038 0.071 -0.071 0.038 -0.092 0.00 -.100 -0.038 -0.092 -0.071 -0.071 -0.092 -0.038 -.100 -0.00 -0.092 0.038 -0.071 0.071 -0.038 0.092 0.00 .100 0.038 0.092 0.071 0.071 0.092 0.038 .100 0.00endCap='falsesolid='falsespine='-15.2 1.4 2.2 -12 -.8 2.2'/>
</Shape>
</Transform>
</Transform>
</Transform>
<Transform rotation='1 0 0 -1.7translation='-17 -4.5 0'>
<Transform scale='.2 .2 .2'>
<Shape USE=' Torus'>
<!-- Knot -->
</Shape>
<Transform translation='-1 0 1.7'>
<Shape>
<Sphere radius='1.5'/>
<Appearance USE=' rope'/>
</Shape>
</Transform>
</Transform>
</Transform>
<Transform DEF='RnS'>
<Transform DEF='ropes'>
<Transform rotation='0 0 1 -.82translation='7 -26 -2.5'>
<Shape>
<Appearance USE=' rope'/>
<Extrusion beginCap='falsecreaseAngle='0.76crossSection='.100 0.00 0.092 -0.038 0.071 -0.071 0.038 -0.092 0.00 -.100 -0.038 -0.092 -0.071 -0.071 -0.092 -0.038 -.100 -0.00 -0.092 0.038 -0.071 0.071 -0.038 0.092 0.00 .100 0.038 0.092 0.071 0.071 0.092 0.038 .100 0.00endCap='falsesolid='falsespine='-33 .9 2.5 -18.5 1.9 2.55'/>
</Shape>
<Shape>
<Appearance USE=' rope'/>
<Extrusion beginCap='falsecreaseAngle='0.76crossSection='.100 0.00 0.092 -0.038 0.071 -0.071 0.038 -0.092 0.00 -.100 -0.038 -0.092 -0.071 -0.071 -0.092 -0.038 -.100 -0.00 -0.092 0.038 -0.071 0.071 -0.038 0.092 0.00 .100 0.038 0.092 0.071 0.071 0.092 0.038 .100 0.00endCap='falsesolid='falsespine='-35.7 -.8 2.5 -18.8 -.8 2.55'/>
</Shape>
</Transform>
</Transform>
<Transform DEF='slingrotation='0 0 1 -.82translation='-4 -15.3 0'>
<Transform>
<Transform rotation='0 1 0 -1.57scale='1 1.3 1translation='.5 0 -1'>
<Transform rotation='0 0 1 1.57'>
<Transform scale='.3 .3 .3'>
<Shape DEF='halfsling'>
<Appearance DEF='clear'>
<Material transparency='.5'/>
</Appearance>
<Extrusion crossSection='0 0 0 5 .5 7 1 8 2 9 3 11 3.5 11.2 4 11 5 9 6 8 6.5 7 6.7 5 6.7 0 0 0spine='0 0 0 .1 0 0'/>
</Shape>
<Transform scale='.3 .3 .3translation='0 -3.5 11.5'>
<Shape USE=' Torus'/>
<Transform translation='0 0 2'>
<Shape>
<Appearance USE=' rope'/>
<Sphere radius='1.5'/>
</Shape>
</Transform>
</Transform>
</Transform>
<Transform scale='.3 .3 .3translation='2 0 0'>
<Shape USE=' halfsling'/>
<Transform scale='.3 .3 .3translation='0 -3.5 11.3'>
<Shape USE=' Torus'/>
<Transform translation='0 0 2'>
<Shape>
<Appearance USE=' rope'/>
<Sphere radius='1.5'/>
</Shape>
</Transform>
</Transform>
</Transform>
<Transform translation='1 -1 0'>
<Shape>
<Extrusion beginCap='falsecreaseAngle='0.785crossSection='1.00 0.00 0.92 -0.38 0.71 -0.71 0.38 -0.92 0.00 -1.00 -0.38 -0.92 -0.71 -0.71 -0.92 -0.38 -1.00 -0.00endCap='falsesolid='falsespine='0 -1 0 0 1 0'/>
<Appearance USE=' clear'/>
</Shape>
</Transform>
</Transform>
</Transform>
<!-- ROUTE information for projectiletransform node:  [from invisiable.value_changed to set_scale ] -->
<Transform DEF='projectiletransformscale='.01 .01 .01'>
<!-- ROUTE information for projectile node:  [from LauncheeScript.whichchoice to whichChoice ] -->
<Switch DEF='projectilewhichChoice='0'>
<Group>
<Transform translation='0 .7 0'>
<Shape>
<Sphere radius='.7'/>
<Appearance DEF='black'>
<Material diffuseColor='0 0 0specularColor='1 1 1'/>
</Appearance>
</Shape>
</Transform>
</Group>
<Group>
<Transform>
<Inline
  url=' "cow.wrl" "http://www.uoguelph.ca/~dchiu/cow.wrl" ' />
</Transform>
</Group>
<Group>
<Transform rotation='0 1 0 1.57scale='.4 .4 .4translation='0 .7 0'> </Transform>
</Group>
</Switch>
</Transform>
</Transform>
</Transform>
</Transform>
</Transform>
<Transform rotation='1 0 0 1.57translation='0 18 2.5'>
<Shape>
<Cylinder height='8radius='.4'/>
<Appearance>
<Material diffuseColor='0 0 0specularColor='1 1 1'/>
</Appearance>
</Shape>
<!-- Top Pivot -->
</Transform>
<!-- ROUTE information for verticalweight node:  [from verticalweightpath.value_changed to set_translation ] -->
<Transform DEF='verticalweight'>
<Transform translation='4 18 1.8'>
<Shape>
<Box size='1 10 .5'/>
<Appearance USE=' wood'/>
</Shape>
</Transform>
<Transform translation='4 18 3.2'>
<Shape>
<Box size='1 10 .5'/>
<Appearance USE=' wood'/>
</Shape>
</Transform>
<Transform translation='4 14 2.5'>
<!-- CounterWeight -->
<Shape>
<Cylinder height='4radius='1.5'/>
<Appearance>
<Material diffuseColor='0 0 0specularColor='1 1 1'/>
</Appearance>
</Shape>
</Transform>
<Transform rotation='1 0 0 1.57translation='4 22 2.5'>
<Shape>
<Cylinder height='2.5radius='.3'/>
<Appearance>
<Material diffuseColor='0 0 0specularColor='1 1 1'/>
</Appearance>
</Shape>
</Transform>
</Transform>
<Transform rotation='0 0 1 1.57scale='.2 .2 .2translation='-11.5 -1 2'>
<Transform DEF='screwrotation='1 0 0 1.57'>
<Shape USE=' Torus'/>
<Transform rotation='1 0 0 -1.57translation='0 0 7'>
<Shape>
<Cylinder height='10radius='.7'/>
<Appearance>
<Material specularColor='1 1 1'/>
</Appearance>
</Shape>
</Transform>
</Transform>
<Transform translation='0 0 7'>
<Transform USE=' screw'/>
</Transform>
<!-- Release Pin -->
<!-- ROUTE information for Pin node:  [from pinpath.value_changed to set_translation ] -->
<Transform DEF='Pinrotation='1 0 0 -1.57translation='0 0 -3'>
<Transform USE=' screw'/>
</Transform>
</Transform>
<Transform translation='0 0 5'>
<Shape USE=' plank'/>
<Transform USE=' angledsupport'/>
<Transform USE=' angledsupport2'/>
<Transform USE=' verticalsupport'/>
<Transform USE=' horizontalsupport'/>
<Transform rotation='0 1 0 1.57scale='.6 1 1translation='0 -11 -2.5'>
<Transform USE=' horizontalsupport'/>
</Transform>
<Transform rotation='0 0 1 -1.57scale='.6 1 1translation='0 5 -10'>
<Transform rotation='0 1 0 .4'>
<Shape USE=' plank'/>
</Transform>
</Transform>
<Transform translation='0 0 .6'>
<Transform USE=' panel'/>
</Transform>
</Transform>
<Transform translation='10 -1 2.5'>
<Shape DEF='Axle'>
<Box size='1 1 8'/>
<Appearance USE=' wood'/>
</Shape>
<Transform rotation='1 0 0 1.57translation='0 0 4.5'>
<Shape DEF='wheel'>
<Cylinder radius='2'/>
<Appearance USE=' wood'/>
</Shape>
<Shape DEF='tracks'>
<Sphere radius='1.5'/>
<Appearance USE=' black'/>
</Shape>
<Transform translation='0 .55 0'>
<Shape DEF='hub'>
<Sphere radius='1.5'/>
<Appearance USE=' black'/>
</Shape>
</Transform>
</Transform>
<Transform rotation='1 0 0 1.57translation='0 0 -4.5'>
<Shape USE=' wheel'/>
<Shape USE=' tracks'/>
<Transform translation='0 -.55 0'>
<Shape USE=' hub'/>
</Transform>
</Transform>
</Transform>
<Transform translation='-10 -1 2.5'>
<Shape USE=' Axle'/>
<Transform rotation='1 0 0 1.57translation='0 0 4.5'>
<Shape USE=' wheel'/>
<Shape USE=' tracks'/>
<Transform translation='0 .55 0'>
<Shape USE=' hub'/>
</Transform>
</Transform>
<Transform rotation='1 0 0 1.57translation='0 0 -4.5'>
<Shape USE=' wheel'/>
<Shape USE=' tracks'/>
<Transform translation='0 -.55 0'>
<Shape USE=' hub'/>
</Transform>
</Transform>
<Transform rotation='0 1 0 -.6translation='0 100 400'>
<Transform translation='1 3 0'>
<Viewpoint description='Side'/>
</Transform>
<Transform USE=' launch'/>
<Transform>
<TouchSensor USE=' LauncheeChoice'/>
<Switch USE=' projectilename'/>
<Transform translation='2.5 0 0'>
<Shape>
<Box size='5 .5 .5'/>
<Appearance>
<Material transparency='1'/>
</Appearance>
</Shape>
</Transform>
</Transform>
<Transform scale='.5 .5 .5translation='0 -1 0'>
<TouchSensor USE=' weightselector'/>
<Switch USE=' Weight'/>
<Transform translation='8 0 0'>
<Shape>
<Box size='17 1 .5'/>
<Appearance>
<Material transparency='1'/>
</Appearance>
</Shape>
</Transform>
</Transform>
</Transform>
<!-- ROUTE information for ProjectileTransform node:  [from Mover.value_changed to set_translation ] [from Mover.transparent to set_scale ] -->
<Transform DEF='ProjectileTransformtranslation='14.25 1.25 0'>
<Switch USE=' projectile'/>
<Transform rotation='0 1 0 1.57translation='0 1 0'>
<Viewpoint description='Projectile Camposition='0 0 15'/>
</Transform>
</Transform>
<Transform translation='20 2 0'>
<Transform DEF='Frontrotation='0 1 0 1.57'>
<Viewpoint description='Fore'/>
</Transform>
</Transform>
<Transform translation='-8 4 0'>
<Transform rotation='0 1 0 -1.57'>
<Viewpoint description='Aft'/>
</Transform>
</Transform>
<field name='set_booleantype='SFBoolaccessType='inputOnly'/>
<field name='whichchoicetype='SFInt32accessType='outputOnly'/>
<field name='CounterWeighttype='SFFloataccessType='outputOnly'/>
<![CDATA[
          
ecmascript:


function initialize ()
{
	whichchoice =0;
	CounterWeight=100;
}

function set_boolean ( boolean_input, eventTime)
{

	if ( boolean_input== false ) { return; } // ignore the unclick
        whichchoice = whichchoice +1;
	if (whichchoice == 0)CounterWeight=50.00;
	if (whichchoice == 1)CounterWeight=500.00;
	if (whichchoice == 2)CounterWeight=1000.00;
	if (whichchoice == 3)CounterWeight=10000.00;
        if ( whichchoice ==4 ) { whichchoice = 0; CounterWeight=50; }


        Browser.println ('CounterWeight ='+CounterWeight);
}

        
]]>
</Script>
<field name='set_booleantype='SFBoolaccessType='inputOnly'/>
<field name='whichchoicetype='SFInt32accessType='outputOnly'/>
<field name='ProjectileWeighttype='SFFloataccessType='outputOnly'/>
<![CDATA[
          
ecmascript:

function set_boolean (boolean_input, eventTime)
{
	if ( boolean_input== false ) { return; } // ignore unclick
        whichchoice = whichchoice +1;
        if (whichchoice == 0)ProjectileWeight=10.00;
        if (whichchoice == 1)ProjectileWeight=1000.00;
	if (whichchoice == 2)ProjectileWeight=5;

	if ( whichchoice ==3 ) { whichchoice = 0; ProjectileWeight=10.00; }
	Browser.println ('Projectile Weight'+ProjectileWeight);
}

        
]]>
</Script>
<!-- ROUTE information for PigdogMonkScript node:  [from Launch.isActive to set_boolean ] [from whichchoice to PigdogMonk.whichChoice ] -->
<Script DEF='PigdogMonkScript'>
<field name='set_booleantype='SFBoolaccessType='inputOnly'/>
<field name='whichchoicetype='SFInt32accessType='outputOnly'/>
<![CDATA[
          
ecmascript:

function set_boolean (boolean_input, eventTime)
{
	if ( boolean_input== false ) { return; } // ignore unclick

        whichchoice = whichchoice +1;

        if ( whichchoice ==2 )  whichchoice = 0;


}

        
]]>
</Script>
<field name='set_fractiontype='SFFloataccessType='inputOnly'/>
<field name='set_MassCounterWeighttype='SFFloataccessType='inputOnly'/>
<field name='set_MassProjectileWeighttype='SFFloataccessType='inputOnly'/>
<field name='MassCounterWeighttype='SFFloatvalue='1accessType='initializeOnly'/>
<field name='MassProjectileWeighttype='SFFloatvalue='1accessType='initializeOnly'/>
<field name='transparenttype='SFVec3faccessType='outputOnly'/>
<field name='value_changedtype='SFVec3faccessType='outputOnly'/>
<![CDATA[
          
ecmascript:

function initialize ()
{
	MassCounterWeight=100;
	MassProjectileWeight=10;
	Browser.println ('MassCounterWeight =' + MassCounterWeight);
	Browser.println ('MassProjectileWeight =' + MassProjectileWeight);
}

function set_MassProjectileWeight (value, timestamp)
{
	MassProjectileWeight = value;
	Browser.println ('new MassProjectileWeight =' + MassProjectileWeight);
}
function set_MassCounterWeight (value2, timestamp)
{
	MassCounterWeight = value2;
	Browser.println ('new MassCounterWeight =' + MassCounterWeight);
}


function set_fraction ( fraction, eventTime )
{
	var TrebuchetHeight=45;
	var Height =25;
      	x = (2*(MassCounterWeight/MassProjectileWeight)*Height*fraction)-.5*TrebuchetHeight;
	// start at TrebuchetHeight and keep along z axis (z=zero)
	y =  (MassCounterWeight/MassProjectileWeight)*Height*Math.sin(fraction*3.14);
        z = 0;
        transparent = new SFVec3f (1,1,1);
     if (y <1.5*TrebuchetHeight  )if (x<TrebuchetHeight)
		{
		x=x-10;
		y=y+1;
		transparent = new SFVec3f(.01, .01, .01);
			}

	value_changed = new SFVec3f (x, y, z);
	Browser.println ('x=' + value_changed[0] + ' y=' + value_changed[1] + ' z=' + value_changed[2]);
}

        
]]>
</Script>
</Transform>
</Transform>

<!-- ROUTE information for verticalweightpath node:  [from clock.fraction_changed to set_fraction ] [from value_changed to verticalweight.set_translation ] -->
<PositionInterpolator DEF='verticalweightpathkey='0 .1 .2 .2 .3 .9keyValue='1.4 1.6 0 1. -8 0 -3.5 -12 0 -3.5 -12 0 1.2 -8 0 1.4 1.6 0'/>

<!-- ROUTE information for flingerangles node:  [from clock.fraction_changed to set_fraction ] [from value_changed to flinger.set_rotation ] -->
<OrientationInterpolator DEF='flingerangleskey='0 .1 .2 .2 .3 .9keyValue='0 0 1 .82 0 0 1 -.77 0 0 1 -1.57 0 0 1 -1.57 0 0 1 -.77 0 0 1 .82'/>

<!-- ROUTE information for pinpath node:  [from clock.fraction_changed to set_fraction ] [from value_changed to Pin.set_translation ] -->
<PositionInterpolator DEF='pinpathkey='0 .01 .95 1keyValue='0 0 -3 0 0 -10 0 0 -10 0 0 -3'/>

<OrientationInterpolator DEF='RnSAngelskey='0 .7 1keyValue='0 0 1 0 0 0 1 -3.14 0 0 1 0'/>
<!-- ROUTE information for invisiable node:  [from clock.fraction_changed to set_fraction ] [from value_changed to projectiletransform.set_scale ] -->
<PositionInterpolator DEF='invisiablekey='0 .2 .98 .99keyValue='1 1 1 .01 .01 .01 .01 .01 .01 1 1 1'/>

< ROUTE  fromNode=' clock' fromField='fraction_changed' toNode=' invisiable' toField='set_fraction'/>
< ROUTE  fromNode=' invisiable' fromField='value_changed' toNode=' projectiletransform' toField='set_scale'/>
< ROUTE  fromNode=' WeightScript' fromField='CounterWeight' toNode=' Mover' toField='set_MassCounterWeight'/>
< ROUTE  fromNode=' LauncheeScript' fromField='ProjectileWeight' toNode=' Mover' toField='set_MassProjectileWeight'/>
< ROUTE  fromNode=' clock' fromField='fraction_changed' toNode=' Mover' toField='set_fraction'/>
< ROUTE  fromNode=' Mover' fromField='value_changed' toNode=' ProjectileTransform' toField='set_translation'/>
< ROUTE  fromNode=' Mover' fromField='transparent' toNode=' ProjectileTransform' toField='set_scale'/>
< ROUTE  fromNode=' Launch' fromField='touchTime' toNode=' clock' toField='set_startTime'/>
< ROUTE  fromNode=' Launch' fromField='isActive' toNode=' PigdogMonkScript' toField='set_boolean'/>
< ROUTE  fromNode=' Launch' fromField='touchTime' toNode=' PigDogSound' toField='set_startTime'/>
< ROUTE  fromNode=' Launch' fromField='touchTime' toNode=' MonkSound' toField='set_startTime'/>
< ROUTE  fromNode=' PigdogMonkScript' fromField='whichchoice' toNode=' PigdogMonk' toField='whichChoice'/>
< ROUTE  fromNode=' LauncheeChoice' fromField='touchTime' toNode=' HolyHandGrenadeSound' toField='set_startTime'/>
< ROUTE  fromNode=' LauncheeChoice' fromField='touchTime' toNode=' CowSound' toField='set_startTime'/>
< ROUTE  fromNode=' LauncheeChoice' fromField='touchTime' toNode=' HamsterSound' toField='set_startTime'/>
< ROUTE  fromNode=' LauncheeChoice' fromField='isActive' toNode=' LauncheeScript' toField='set_boolean'/>
< ROUTE  fromNode=' LauncheeScript' fromField='whichchoice' toNode=' projectile' toField='whichChoice'/>
< ROUTE  fromNode=' LauncheeScript' fromField='whichchoice' toNode=' projectilename' toField='whichChoice'/>
< ROUTE  fromNode=' weightselector' fromField='isActive' toNode=' WeightScript' toField='set_boolean'/>
< ROUTE  fromNode=' WeightScript' fromField='whichchoice' toNode=' Weight' toField='whichChoice'/>
< ROUTE  fromNode=' clock' fromField='fraction_changed' toNode=' flingerangles' toField='set_fraction'/>
< ROUTE  fromNode=' flingerangles' fromField='value_changed' toNode=' flinger' toField='set_rotation'/>
< ROUTE  fromNode=' clock' fromField='fraction_changed' toNode=' verticalweightpath' toField='set_fraction'/>
< ROUTE  fromNode=' verticalweightpath' fromField='value_changed' toNode=' verticalweight' toField='set_translation'/>
< ROUTE  fromNode=' clock' fromField='fraction_changed' toNode=' pinpath' toField='set_fraction'/>
< ROUTE  fromNode=' pinpath' fromField='value_changed' toNode=' Pin' toField='set_translation'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: aft, angledsupport, angledsupport2, Axle, black, clear, clock, CowSound, flinger, flingerangles, Front, halfsling, HamsterSound, HolyGrail, HolyHandGrenadeSound, horizontalsupport, hub, invisiable, Launch, launch, LauncheeChoice, LauncheeScript, MonkSound, Mover, panel, PigdogMonk, PigdogMonkScript, PigDogSound, Pin, pinpath, plank, projectile, projectilename, ProjectileTransform, projectiletransform, RnS, RnSAngels, rope, ropes, screw, sling, TextAppearance, Torus, tracks, verticalsupport, verticalweight, verticalweightpath, Weight, WeightScript, weightselector, wheel, wood, woodTexture

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2, Viewpoint_3, Viewpoint_4
-->

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

Launch
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
clock
TimeSensor
set_startTime
SFTime

 
 
then
clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
invisiable
PositionInterpolator
set_fraction
SFFloat

 
 
then
invisiable
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
projectiletransform
Transform
set_scale
SFVec3f
 
 
 
then
clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
Mover
Script
set_fraction
SFFloat

 
 
then
Mover
Script
transparent
SFVec3f

ROUTE
event to
(3)
ProjectileTransform
Transform
set_scale
SFVec3f
 
 
 
then
Mover
Script
value_changed
SFVec3f

ROUTE
event to
(3)
ProjectileTransform
Transform
set_translation
SFVec3f
 
 
 
then
clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
flingerangles
OrientationInterpolator
set_fraction
SFFloat

 
 
then
flingerangles
OrientationInterpolator
value_changed
SFRotation

ROUTE
event to
(3)
flinger
Transform
set_rotation
SFRotation
 
 
 
then
clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
verticalweightpath
PositionInterpolator
set_fraction
SFFloat

 
 
then
verticalweightpath
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
verticalweight
Transform
set_translation
SFVec3f
 
 
 
then
clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
pinpath
PositionInterpolator
set_fraction
SFFloat

 
 
then
pinpath
PositionInterpolator
value_changed
SFVec3f

ROUTE
event to
(3)
Pin
Transform
set_translation
SFVec3f
Launch
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
PigdogMonkScript
Script
set_boolean
SFBool

 
 
then
PigdogMonkScript
Script
whichchoice
SFInt32

ROUTE
event to
(2)
PigdogMonk
Switch
whichChoice
SFInt32
Launch
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
PigDogSound
AudioClip
set_startTime
SFTime
Launch
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
MonkSound
AudioClip
set_startTime
SFTime


LauncheeChoice
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
HolyHandGrenadeSound
AudioClip
set_startTime
SFTime
LauncheeChoice
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
CowSound
AudioClip
set_startTime
SFTime
LauncheeChoice
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
HamsterSound
AudioClip
set_startTime
SFTime
LauncheeChoice
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
LauncheeScript
Script
set_boolean
SFBool

 
 
then
LauncheeScript
Script
ProjectileWeight
SFFloat

ROUTE
event to
(2)
Mover
Script
set_MassProjectileWeight
SFFloat

 
 
then
Mover
Script
transparent
SFVec3f

ROUTE
event to
(3)
ProjectileTransform
Transform
set_scale
SFVec3f
 
 
 
then
Mover
Script
value_changed
SFVec3f

ROUTE
event to
(3)
ProjectileTransform
Transform
set_translation
SFVec3f
 
 
 
then
LauncheeScript
Script
whichchoice
SFInt32

ROUTE
event to
(2)
projectile
Switch
whichChoice
SFInt32
 
 
 
then
LauncheeScript
Script
whichchoice
SFInt32

ROUTE
event to
(2)
projectilename
Switch
whichChoice
SFInt32


weightselector
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
WeightScript
Script
set_boolean
SFBool

 
 
then
WeightScript
Script
CounterWeight
SFFloat

ROUTE
event to
(2)
Mover
Script
set_MassCounterWeight
SFFloat

 
 
then
Mover
Script
transparent
SFVec3f

ROUTE
event to
(3)
ProjectileTransform
Transform
set_scale
SFVec3f
 
 
 
then
Mover
Script
value_changed
SFVec3f

ROUTE
event to
(3)
ProjectileTransform
Transform
set_translation
SFVec3f
 
 
 
then
WeightScript
Script
whichchoice
SFInt32

ROUTE
event to
(2)
Weight
Switch
whichChoice
SFInt32


      Mover
Script
value_changed
SFVec3f

ROUTE
event to
(1)
ProjectileTransform
Transform
set_translation
SFVec3f
Mover
Script
transparent
SFVec3f

ROUTE
event to
(1)
ProjectileTransform
Transform
set_scale
SFVec3f


      WeightScript
Script
CounterWeight
SFFloat

ROUTE
event to
(1)
Mover
Script
set_MassCounterWeight
SFFloat

 
 
then
Mover
Script
transparent
SFVec3f

ROUTE
event to
(2)
ProjectileTransform
Transform
set_scale
SFVec3f
 
 
 
then
Mover
Script
value_changed
SFVec3f

ROUTE
event to
(2)
ProjectileTransform
Transform
set_translation
SFVec3f
WeightScript
Script
whichchoice
SFInt32

ROUTE
event to
(1)
Weight
Switch
whichChoice
SFInt32



-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/TrebuchetIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/StudentProjects/Trebuchet.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. -->