<?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='Bounce3.x3d'/>
<meta name='descriptioncontent='ouncing beachball (with prototype and JavaScript): this world illustrates the use of a PROTO to encapsulate a Script node, timer, shape, and routes to create a vertically bouncing beach ball. The bounce path is based upon the projectile motion equation of physics, constrained to create a cyclic bouncing path with a user-selected maximum bounce height. Also, there is no friction, drag, or damping. For an explanation of the script, see bounce1.wrl.'/>
<meta name='creatorcontent='David R. Nadeau'/>
<meta name='translatorcontent='Don Brutzman'/>
<meta name='createdcontent='1 July 1998'/>
<meta name='translatedcontent='2 February 2014'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='referencecontent='originals/bounce3.wrl'/>
<meta name='referencecontent=' http://www.siggraph.org/s98 '/>
<meta name='referencecontent=' http://www.siggraph.org/s98/conference/courses/18.html '/>
<meta name='referencecontent=' http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0487.htm '/>
<meta name='referencecontent=' http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm '/>
<meta name='referencecontent=' https://www.web3d.org/x3d/content/examples/X3dResources.html '/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Bounce3.x3d '/>
<meta name='generatorcontent='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/>
<meta name='generatorcontent='X3D-Edit, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!--

Index for ProtoDeclare definition : BouncingBall

Index for DEF nodes : Ball, Bouncer, Clock, Palm

Index for Viewpoint image : Viewpoint_1
-->
<Scene>
<WorldInfo info='"Copyright (c) 1997, David R. Nadeau"title='Bouncing beachball (PROTO)'/>
<Viewpoint description='Bouncing beachball, with prototype and JavaScriptorientation='1.0 0.0 0.0 0.1position='0.0 0.6 8.0'/>
<NavigationInfo headlight='falsespeed='2.0'/>
<DirectionalLight ambientIntensity='0.5direction='0.0 -1.0 -0.5'/>
<Background skyAngle='1.371 1.571skyColor='0.0 0.0 1.0 0.0 0.5 1.0 0.7 0.7 1.0'/>
<Shape>
<Appearance>
<TextureTransform scale='10.0 10.0'/>
<Material/>
<ImageTexture
  url=' "sand.jpg" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/sand.jpg" '/>
</Appearance>
<IndexedFaceSet solid='falsecoordIndex='0 1 2 3'>
<Coordinate point='-50.0 -1.0 50.0 50.0 -1.0 50.0 50.0 -1.0 -50.0 -50.0 -1.0 -50.0'/>
</IndexedFaceSet>
</Shape>
<Transform translation='-3.0 -1.0 -10.0'>
<Group DEF='Palm'>
<Billboard>
<Shape>
<Appearance> </Appearance>
<IndexedFaceSet solid='falsecoordIndex='0 1 2 3texCoordIndex='0 1 2 3'>
<TextureCoordinate point='0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0'/>
<Coordinate point='-2.5 0.0 0.0 2.5 0.0 0.0 2.5 11.25 0.0 -2.5 11.25 0.0'/>
</IndexedFaceSet>
</Shape>
</Billboard>
<Shape>
<Appearance>
<Material diffuseColor='0.0 0.0 0.0transparency='0.5'/>
<ImageTexture
  url=' "palmsh.png" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/palmsh.png" '/>
</Appearance>
<IndexedFaceSet solid='falsecoordIndex='0 1 2 3texCoordIndex='0 1 2 3'>
<TextureCoordinate point='0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0'/>
<Coordinate point='-2.5 0.05 2.5 2.5 0.05 2.5 2.5 0.05 -2.5 -2.5 0.05 -2.5'/>
</IndexedFaceSet>
</Shape>
</Group>
</Transform>
<Transform scale='0.6 0.6 0.6translation='-5.0 -1.0 -6.0'>
<Group USE='Palm'/>
</Transform>
<Transform translation='5.0 -1.0 -9.0'>
<Group USE='Palm'/>
</Transform>
<Transform translation='10.0 -1.0 -15.0'>
<Group USE='Palm'/>
</Transform>
<ProtoDeclare name='BouncingBall'>
<ProtoInterface>
<field name='bounceTimetype='SFTimevalue='1.0accessType='initializeOnly'/>
<field name='bounceHeighttype='SFFloatvalue='1.0accessType='initializeOnly'/>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for Ball node:  [from Bouncer.value_changed to set_translation ] -->
<Transform DEF='Ball'>
<Shape>
<Appearance>
<TextureTransform scale='2.0 1.0'/>
<Material ambientIntensity='0.5diffuseColor='1.0 1.0 1.0shininess='0.4specularColor='0.7 0.7 0.7'/>
<ImageTexture
  url=' "beach.jpg" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/beach.jpg" '/>
</Appearance>
<Sphere/>
</Shape>
</Transform>
<!-- ROUTE information for Clock node:  [from fraction_changed to Bouncer.set_fraction ] -->
<TimeSensor DEF='Clockloop='truestartTime='1.0'>
<IS>
<connect nodeField='cycleIntervalprotoField='bounceTime'/>
</IS>
</TimeSensor>
<!-- ROUTE information for Bouncer node:  [from Clock.fraction_changed to set_fraction ] [from value_changed to Ball.set_translation ] -->
<Script DEF='Bouncer'>
<field name='value_changedtype='SFVec3faccessType='outputOnly'/>
<field name='bounceHeighttype='SFFloataccessType='initializeOnly'/>
<field name='set_fractiontype='SFFloataccessType='inputOnly'/>
<IS>
<connect nodeField='bounceHeightprotoField='bounceHeight'/>
</IS>
<![CDATA[
          
ecmascript:
            function set_fraction( frac, tm ) {
                y = 4.0 * bounceHeight * frac * (1.0 - frac);
                value_changed[0] = 0.0;
                value_changed[1] = y;
                value_changed[2] = 0.0;
            }

        
]]>
</Script>
<ROUTE fromNode='ClockfromField='fraction_changedtoNode='BouncertoField='set_fraction'/>
<ROUTE fromNode='BouncerfromField='value_changedtoNode='BalltoField='set_translation'/>
</ProtoBody>
</ProtoDeclare>
<ProtoInstance name='BouncingBall'>
<fieldValue name='bounceTimevalue='2.0'/>
<fieldValue name='bounceHeightvalue='3.0'/>
</ProtoInstance>
<Transform translation='2.0 0.0 -2.0'>
<ProtoInstance name='BouncingBall'>
<fieldValue name='bounceTimevalue='2.2'/>
<fieldValue name='bounceHeightvalue='2.5'/>
</ProtoInstance>
</Transform>
<Transform translation='-2.0 0.0 -2.0'>
<ProtoInstance name='BouncingBall'>
<fieldValue name='bounceTimevalue='2.4'/>
<fieldValue name='bounceHeightvalue='3.5'/>
</ProtoInstance>
</Transform>
</Scene>
</X3D>
<!--

Index for ProtoDeclare definition : BouncingBall

Index for DEF nodes : Ball, Bouncer, Clock, Palm

Index for Viewpoint image : Viewpoint_1
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
    <Prototype name='ProtoName'> <field name='fieldName'/> </Prototype> -->

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