<?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 name='titlecontent='TwoBladeTailRotorPrototype.x3d'/>
<meta name='descriptioncontent='Prototypes a two-blade tail rotor and its shaft for a helicopter.'/>
<meta name='creatorcontent='Jane Wu'/>
<meta name='createdcontent='21 March 2001'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='identifiercontent=' https://savage.nps.edu/Savage/AircraftHelicopters/AH1SuperCobraUnitedStates/TwoBladeTailRotorPrototype.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../../license.html'/>
</head>
<!-- -->
<Scene>
<ProtoDeclare name='TwoBladeTailRotor'>
<ProtoInterface>
<field name='rotationOntype='SFBoolaccessType='inputOnly'
 appinfo='enable or disable rotor rotation'/>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for TailRotor node:  [from TailRotorPath.value_changed to set_rotation ] -->
<Transform DEF='TailRotorbboxCenter='0 0 0bboxSize='-1 -1 -1'>
<!-- Tail Rotor Shaft -->
<Transform rotation='1.0 0.0 0.0 1.57translation='0.0 0.0 -0.1bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Appearance DEF='Gray'>
<Material diffuseColor='0.75 0.75 0.75'/>
</Appearance>
<Cylinder height='0.2radius='0.02'/>
</Shape>
</Transform>
<!-- ROUTE information for RotationSwitch node:  [from BladeRotationOnOffScript.switchChoice to whichChoice ] -->
<Switch DEF='RotationSwitchwhichChoice='0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Group DEF='TwoBladesbboxCenter='0 0 0bboxSize='-1 -1 -1'>
<!-- put top blade on -->
<!-- Rotate 15 degree along y -->
<Transform rotation='0 1 0 0.26translation='-0.05 0.0 0.0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Appearance DEF='DarkGray'>
<Material diffuseColor='0.2 0.2 0.2'/>
</Appearance>
<Extrusion DEF='TopTailRotorconvex='falsecreaseAngle='0.8crossSection='0.00 0.00 0.03 -0.005 0.05 -0.007 0.07 -0.009 0.09 -0.01 0.11 -0.009 0.12 -0.007 0.13 -0.005 0.135 0.0 0.13 0.005 0.12 0.007 0.11 0.009 0.09 0.01 0.07 0.009 0.05 0.007 0.03 0.005solid='falsespine='-0.015 0.02 0.0 -0.015 0.82 0.0'/>
</Shape>
</Transform>
<!-- put bottom blade on -->
<!-- Rotate -15 degree along y -->
<Transform rotation='0 1 0 -0.26bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Appearance USE='DarkGray'/>
<Extrusion DEF='BottomTailRotorconvex='falsecreaseAngle='0.8crossSection='0.00 0.00 0.03 -0.005 0.05 -0.007 0.07 -0.009 0.09 -0.01 0.11 -0.009 0.12 -0.007 0.13 -0.005 0.135 0.0 0.13 0.005 0.12 0.007 0.11 0.009 0.09 0.01 0.07 0.009 0.05 0.007 0.03 0.005solid='falsespine='0.065 -0.02 0.0 0.065 -0.82 0.0'/>
</Shape>
</Transform>
</Group>
<LOD range='50 200bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Group USE='TwoBladesbboxCenter='0 0 0bboxSize='-1 -1 -1'/>
<Group bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Transform rotation='1 0 0 1.57bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Appearance>
<Material diffuseColor='0.2 0.2 0.2transparency='0.75'/>
</Appearance>
<Cylinder height='0.1radius='0.82'/>
</Shape>
</Transform>
</Group>
<WorldInfo title='null'/>
</LOD>
</Switch>
<!-- ROUTE information for BladeRotationOnOffScript node:  [from clockEnabled to TailRotorClock.set_enabled ] [from switchChoice to RotationSwitch.whichChoice ] -->
<Script DEF='BladeRotationOnOffScript'>
<field name='rotationOntype='SFBoolaccessType='inputOnly'/>
<field name='clockEnabledtype='SFBoolaccessType='outputOnly'/>
<field name='switchChoicetype='SFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='rotationOnprotoField='rotationOn'/>
</IS>
<![CDATA[
            
ecmascript:

function rotationOn(value, timeStamp) {
   if (value == true)
   {
      clockEnabled = true;
      switchChoice = 1;
   }
   else
   {
      clockEnabled = false;
      switchChoice = 0;
   }
}

          
]]>
</Script>
<!-- Animation Clock -->
<!-- ROUTE information for TailRotorClock node:  [from BladeRotationOnOffScript.clockEnabled to set_enabled ] [from fraction_changed to TailRotorPath.set_fraction ] -->
<TimeSensor DEF='TailRotorClockcycleInterval='0.5enabled='falseloop='true'/>
<!-- Animation Path -->
<!-- ROUTE information for TailRotorPath node:  [from TailRotorClock.fraction_changed to set_fraction ] [from value_changed to TailRotor.set_rotation ] -->
<OrientationInterpolator DEF='TailRotorPathkey='0.0 0.25 0.5 0.75 1.0keyValue='0.00 0.00 1.00 0.00 0.00 0.00 1.00 1.57 0.00 0.00 1.00 3.14 0.00 0.00 1.00 4.712 0.00 0.00 1.00 6.284'/>
</Transform>
<ROUTE fromNode='BladeRotationOnOffScriptfromField='clockEnabledtoNode='TailRotorClocktoField='set_enabled'/>
<ROUTE fromNode='BladeRotationOnOffScriptfromField='switchChoicetoNode='RotationSwitchtoField='whichChoice'/>
<ROUTE fromNode='TailRotorClockfromField='fraction_changedtoNode='TailRotorPathtoField='set_fraction'/>
<ROUTE fromNode='TailRotorPathfromField='value_changedtoNode='TailRotortoField='set_rotation'/>
</ProtoBody>
</ProtoDeclare>
<!-- ============================================================ -->
<WorldInfo title='TwoBladeTailRotor Prototype'/>
<Background skyColor='.4 .4 .6'/>
<Viewpoint description='Toggle Blade Statusposition='0 0 12'/>
<Viewpoint description='At a distanceposition='0 0 50'/>
<!-- ROUTE information for ExampleTailRotor node:  [from ExampleSelection.status to rotationOn ] -->
<ProtoInstance name='TwoBladeTailRotorDEF='ExampleTailRotor'/>
<Transform translation='0 2.5 0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<!-- ROUTE information for ExampleBladeRotationToggle node:  [from isActive to ExampleSelection.toggleEnabled ] -->
<TouchSensor DEF='ExampleBladeRotationToggledescription='Toggle blade rotation on/off'/>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Appearance>
<!-- ROUTE information for ToggleStatusColor node:  [from ExampleSelection.statusColor to diffuseColor ] -->
<Material DEF='ToggleStatusColordiffuseColor='0.8 0.8 0'/>
</Appearance>
<Text string=' "Select Text to Toggle"
"Blade Rotation On/Off"
'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
</Shape>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Box size='8.5 2.0 0.01solid='true'/>
<Appearance>
<Material transparency='1'/>
</Appearance>
</Shape>
</Transform>
<!-- ROUTE information for ExampleSelection node:  [from ExampleBladeRotationToggle.isActive to toggleEnabled ] [from statusColor to ToggleStatusColor.diffuseColor ] [from status to ExampleTailRotor.rotationOn ] -->
<Script DEF='ExampleSelection'>
<field name='armedtype='SFInt32value='-1accessType='initializeOnly'/>
<field name='toggleEnabledtype='SFBoolaccessType='inputOnly'/>
<field name='statusColortype='SFColoraccessType='outputOnly'/>
<field name='statustype='SFBoolaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:

function toggleEnabled(value, ts) {
   if (armed == -1)
   {
      toggleEnabled = false;
      armed = 0;
   }

   if (armed == 0)
   {
      armed = 1;

      if (toggleEnabled == false)
      {
         status = true;
         statusColor = new SFColor(0, 0.8, 0);
         toggleEnabled = true;
      }
      else
      {
         status = false;
         statusColor = new SFColor(0.8, 0.8, 0);
         toggleEnabled = false;
      }
   }
   else
   {
      armed = 0;
      return;
   }
}

    
]]>
</Script>
<ROUTE fromNode='ExampleBladeRotationTogglefromField='isActivetoNode='ExampleSelectiontoField='toggleEnabled'/>
<ROUTE fromNode='ExampleSelectionfromField='statusColortoNode='ToggleStatusColortoField='diffuseColor'/>
<ROUTE fromNode='ExampleSelectionfromField='statustoNode='ExampleTailRotortoField='rotationOn'/>
</Scene>
</X3D>
<!--

Index for ProtoDeclare definition : TwoBladeTailRotor

Index for DEF nodes : BladeRotationOnOffScript, BottomTailRotor, DarkGray, ExampleBladeRotationToggle, ExampleSelection, ExampleTailRotor, Gray, RotationSwitch, TailRotor, TailRotorClock, TailRotorPath, ToggleStatusColor, TopTailRotor, TwoBlades

Index for Viewpoint images : Viewpoint_1, Viewpoint_2
-->

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

<!-- Additional help information about X3D scenes: X3D Resources, X3D Scene Authoring Hints and X3D Tooltips -->