<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://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='http://www.web3d.org/specifications/x3d-3.0.xsd'>
  <head>
    <meta content='Figure27.3CollisionDetectionSpinningOrb.x3d' name='title'/>
    <meta content='Figure 27.3, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland' name='creator'/>
    <meta content='http://www.wiley.com/legacy/compbooks/vrml2sbk/ch27/27fig03.htm' name='reference'/>
    <meta content='Don Brutzman' name='translator'/>
    <meta content='26 October 2000' name='created'/>
    <meta content='11 January 2014' name='modified'/>
    <meta content='An orb that animates (for a single revolution) when the viewer collides with its box proxy shape. Walk towards the orb by using the up-arrow key.' name='description'/>
    <meta content='http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter27-SensingVisibilityProximityCollision/Figure27.3CollisionDetectionSpinningOrb.x3d' name='identifier'/>
    <meta content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit' name='generator'/>
    <meta content='../../license.html' name='license'/>
  </head>
  <Scene>
    <Viewpoint description='Zoom in on the orb to trigger the Collision node' position='0 2 10'/>
    <Viewpoint description='Close-up viewpoint by the orb that triggers the Collision node' position='0 0.8 2.5'/>
    <!-- Note NavigationInfo avatarSize affects collision range -->
    <NavigationInfo avatarSize='2 1 0.5' headlight='false' speed='2' type='"WALK" "EXAMINE" "ANY"'/>
    <Group>
      <Transform translation='0 0 2.5'>
        <Inline DEF='Floor' url='"../Chapter25-LevelOfDetail/Figure25.06DungeonRoomFloor.x3d" "http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter25-LevelOfDetail/Figure25.06DungeonRoomFloor.x3d" "../Chapter25-LevelOfDetail/Figure25.06DungeonRoomFloor.wrl" "http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter25-LevelOfDetail/Figure25.06DungeonRoomFloor.wrl"'/>
      </Transform>
      <Transform translation='0 0 -2.5'>
        <Inline USE='Floor'/>
      </Transform>
      <Collision DEF='OrbCollide'>
        <!-- Note that proxy geometry is not rendered -->
        <Transform DEF='ProxyGeometryTransform' containerField='proxy' translation='0 0.6 0'>
          <Shape>
            <Box size='0.4 1.2 0.4'/>
            <Appearance>
              <Material transparency='0.8'/>
            </Appearance>
          </Shape>
        </Transform>
        <!-- If you want to also see the simplifying proxy geometry, DEF/USE it outside of the proxy containerField subtree. -->
        <Transform USE='ProxyGeometryTransform'/>
        <!-- Rest of collidable scene follows. -->
        <Transform DEF='OrbSpin' translation='0 1 0'>
          <PointLight ambientIntensity='0.2' color='0.7 0.5 0' location='0.3 0 0' radius='10'/>
          <Shape>
            <Appearance>
              <ImageTexture url='"fire.jpg" "http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter27-SensingVisibilityProximityCollision/fire.jpg"'/>
              <!-- alternate emissive material as backup, comparable to fire.jpg texturing -->
              <Material emissiveColor='0.8 0.4 0.1'/>
            </Appearance>
            <Sphere radius='0.2'/>
          </Shape>
        </Transform>
      </Collision>
      <Shape>
        <Appearance DEF='PedestalColor'>
          <Material diffuseColor='0.7 0.6 0.5'/>
        </Appearance>
        <IndexedFaceSet coordIndex='0 1 4 -1 1 2 4 -1 2 3 4 -1 3 0 4 -1'>
          <Coordinate point='-0.12 0.03 0.12 0.12 0.03 0.12 0.12 0.03 -0.12 -0.12 0.03 -0.12 0.0 0.63 0.0'/>
        </IndexedFaceSet>
      </Shape>
      <Transform translation='0 0.015 0'>
        <Shape>
          <Appearance USE='PedestalColor'/>
          <Box size='0.4 0.03 0.4'/>
        </Shape>
      </Transform>
    </Group>
    <Sound DEF='WispyAmp' intensity='0.5'>
      <AudioClip DEF='Wispy' description='drone' loop='true' url='"drone1.wav" "http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter27-SensingVisibilityProximityCollision/drone1.wav"'/>
    </Sound>
    <!-- Animation clock -->
    <TimeSensor DEF='Clock' cycleInterval='8'/>
    <ROUTE fromField='collideTime' fromNode='OrbCollide' toField='set_startTime' toNode='Clock'/>
    <ROUTE fromField='collideTime' fromNode='OrbCollide' toField='set_startTime' toNode='Wispy'/>
    <!-- Orb rotation animation and scalar-driven volume control -->
    <OrientationInterpolator DEF='OrbSpinner' key='0 0.5 1' keyValue='0 1 0 0.0 0 1 0 3.14 0 1 0 6.28'/>
    <ROUTE fromField='fraction_changed' fromNode='Clock' toField='set_fraction' toNode='OrbSpinner'/>
    <ROUTE fromField='value_changed' fromNode='OrbSpinner' toField='set_rotation' toNode='OrbSpin'/>
    <ScalarInterpolator DEF='WispyVolume' key='0 0.1 0.9 1' keyValue='0 0.6 0.6 0'/>
    <ROUTE fromField='fraction_changed' fromNode='Clock' toField='set_fraction' toNode='WispyVolume'/>
    <ROUTE fromField='value_changed' fromNode='WispyVolume' toField='set_intensity' toNode='WispyAmp'/>
  </Scene>
</X3D>