<?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 content='KeySensorLefty.x3d' name='title'/>
    <meta content='A KeySensor is used to change relative Viewpoints looking at the shark Lefty, while a SphereSensor can also rotate Lefty in place.' name='description'/>
    <meta content='Leonard Daly and Don Brutzman' name='creator'/>
    <meta content='10 June 2006' name='created'/>
    <meta content='20 October 2019' name='modified'/>
    <meta content='https://X3dGraphics.com' name='reference'/>
    <meta content='https://www.web3d.org/x3d/content/examples/X3dResources.html' name='reference'/>
    <meta content='Copyright 2006, Leonard Daly and Don Brutzman' name='rights'/>
    <meta content='X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com' name='subject'/>
    <meta content='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter08UserInteractivity/KeySensorLefty.x3d' name='identifier'/>
    <meta content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='../license.html' name='license'/>
  </head>
  <Scene>
    <WorldInfo title='KeySensorLefty.x3d'/>
    <Background skyColor='1 1 1'/>
    <Group DEF='LeftyViewpointsUnrotated'>
      <Viewpoint DEF='View1' description='Lefty from the Right'/>
      <Viewpoint DEF='View2' description='Lefty from the Front' orientation='0 1 0 1.57' position='10 0 0'/>
      <Viewpoint DEF='View3' description='Lefty from the Left' orientation='0 1 0 3.14' position='0 0 -10'/>
      <Viewpoint DEF='View4' description='Lefty from Behind' orientation='0 1 0 -1.57' position='-10 0 0'/>
      <Viewpoint DEF='View5' description='Lefty from the Top' orientation='1 0 0 -1.57' position='0 10 0'/>
      <Viewpoint DEF='View6' description='Lefty from the Bottom' orientation='1 0 0 1.57' position='0 -10 0'/>
    </Group>
    <Transform translation='-2 2 0'>
      <Billboard axisOfRotation='0 0 0'>
        <Shape>
          <Appearance>
            <Material diffuseColor='0 0 0'/>
          </Appearance>
          <Text string='"Press &apos;n&apos; key for next Viewpoint," "press &apos;p&apos; key ppnnfor previous Viewpoint."'>
            <FontStyle family='"SANS"' justify='"BEGIN" "BEGIN"' size='0.5'/>
          </Text>
        </Shape>
      </Billboard>
    </Transform>
    <Transform DEF='OrientationControl' translation='2 -2 3'>
      <SphereSensor DEF='Rotator' description='Select and drag to rotate'/>
      <Transform DEF='OrientationDisplay'>
        <Shape>
          <Appearance>
            <Material diffuseColor='0 0 1'/>
          </Appearance>
          <Sphere radius='.5'/>
        </Shape>
      </Transform>
    </Transform>
    <Transform scale='3 3 3'>
      <Transform DEF='ReOrient'>
        <Inline url='"../KelpForestExhibit/SharkLefty.x3d" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SharkLefty.x3d" "../KelpForestExhibit/SharkLefty.wrl" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SharkLefty.wrl"'/>
      </Transform>
    </Transform>
    <ROUTE fromField='rotation_changed' fromNode='Rotator' toField='rotation' toNode='OrientationDisplay'/>
    <ROUTE fromField='rotation_changed' fromNode='Rotator' toField='rotation' toNode='ReOrient'/>
    <KeySensor DEF='KeyDetector'/>
    <Script DEF='KeyHandler' url='"KeySensorLeftyScript.js" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter08UserInteractivity/KeySensorLeftyScript.js"'>
      <field accessType='inputOnly' name='keyPress' type='SFString'/>
      <field accessType='initializeOnly' name='viewpointIndex' type='SFInt32' value='1'/>
      <field accessType='outputOnly' name='bind_View1' type='SFBool'/>
      <field accessType='outputOnly' name='bind_View2' type='SFBool'/>
      <field accessType='outputOnly' name='bind_View3' type='SFBool'/>
      <field accessType='outputOnly' name='bind_View4' type='SFBool'/>
      <field accessType='outputOnly' name='bind_View5' type='SFBool'/>
      <field accessType='outputOnly' name='bind_View6' type='SFBool'/>
    </Script>
    <ROUTE fromField='keyPress' fromNode='KeyDetector' toField='keyPress' toNode='KeyHandler'/>
    <ROUTE fromField='bind_View1' fromNode='KeyHandler' toField='set_bind' toNode='View1'/>
    <ROUTE fromField='bind_View2' fromNode='KeyHandler' toField='set_bind' toNode='View2'/>
    <ROUTE fromField='bind_View3' fromNode='KeyHandler' toField='set_bind' toNode='View3'/>
    <ROUTE fromField='bind_View4' fromNode='KeyHandler' toField='set_bind' toNode='View4'/>
    <ROUTE fromField='bind_View5' fromNode='KeyHandler' toField='set_bind' toNode='View5'/>
    <ROUTE fromField='bind_View6' fromNode='KeyHandler' toField='set_bind' toNode='View6'/>
  </Scene>
</X3D>