<?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='FourBladeMainRotorPrototype.x3d'/>
<meta name='descriptioncontent='Prototypes a 4 blade main rotor and its shaft for a helicopter, rotating clockwise as seen from above.'/>
<meta name='creatorcontent='Jane Wu, Etsuko Lippi'/>
<meta name='createdcontent='21 March 2001'/>
<meta name='modifiedcontent='14 February 2015'/>
<meta name='referencecontent='SuperCobraPrototype.x3d'/>
<meta name='identifiercontent=' https://savage.nps.edu/Savage/AircraftHelicopters/AH1SuperCobra-UnitedStates/FourBladeMainRotorPrototype.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../../license.html'/>
</head>
<!-- -->
<Scene>
<ProtoDeclare name='FourBladeMainRotor'>
<ProtoInterface>
<field name='rotationOntype='SFBoolaccessType='inputOnly'
 appinfo='enable or disable rotor rotation'/>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for MainRotor node:  [from MainRotorPath.value_changed to set_rotation ] -->
<Transform DEF='MainRotor'>
<!-- Rotor Shaft -->
<Transform scale='0.6 0.6 0.6'>
<Shape>
<Appearance DEF='ShaftColor'>
<Material diffuseColor='0.5 0.5 0.5'/>
</Appearance>
<Cylinder bottom='falseheight='1.5radius='0.1top='false'/>
</Shape>
<Transform translation='0 0.75 0'>
<Shape>
<Appearance USE='ShaftColor'/>
<Cylinder height='0.1radius='0.4'/>
</Shape>
</Transform>
<Transform rotation='1 0 0 1.57translation='0 0.75 0'>
<Shape DEF='Arm'>
<Appearance USE='ShaftColor'/>
<Cylinder height='1.75radius='0.05'/>
</Shape>
</Transform>
<Transform rotation='0 0 1 1.57translation='0 0.75 0'>
<Shape USE='Arm'/>
</Transform>
<Transform translation='0 -0.4 0'>
<Shape>
<Appearance USE='ShaftColor'/>
<Cylinder height='0.1radius='0.3'/>
</Shape>
</Transform>
<Transform rotation='0.71 0.02 -0.71 0.10translation='0.23 0.15 0.23'>
<Shape DEF='Tube'>
<Appearance USE='ShaftColor'/>
<Cylinder height='1.1radius='0.05'/>
</Shape>
</Transform>
<Transform rotation='-0.71 0.02 0.71 0.10translation='-0.23 0.15 -0.23'>
<Shape USE='Tube'/>
</Transform>
<Transform rotation='0.71 -0.02 0.71 0.10translation='-0.23 0.15 0.23'>
<Shape USE='Tube'/>
</Transform>
<Transform rotation='-0.71 -0.02 -0.71 0.10translation='0.23 0.15 -0.23'>
<Shape USE='Tube'/>
</Transform>
</Transform>
<!-- ROUTE information for RotationSwitch node:  [from BladeRotationOnOffScript.switchChoice to whichChoice ] -->
<Switch DEF='RotationSwitchwhichChoice='0'>
<Group DEF='FourBlades'>
<!-- Blade in x direction -->
<!-- Rotate 90 + 15 degree along x -->
<Transform rotation='1 0 0 1.83translation='0.45 0.375 0.25'>
<Shape DEF='Blade'>
<Appearance DEF='BladeColor'>
<Material diffuseColor='0.2 0.2 0.2'/>
</Appearance>
<Extrusion ccw='falsecreaseAngle='0.8crossSection='-0.10 0.00 0.06 -0.01 0.10 -0.02 0.16 -0.03 0.22 -0.035 0.28 -0.03 0.30 -0.025 0.32 -0.02 0.331 0.00 0.32 0.016 0.30 0.018 0.28 0.02 0.22 0.02 0.16 0.02 0.10 0.018 0.06 0.01 -0.10 0.00spine='0.08 0.0 0.0 5.3 0.0 0.0'/>
</Shape>
</Transform>
<!-- Blade in -z direction -->
<!-- Rotate 180 - 15 degree along z -->
<Transform rotation='0 0 1 2.88translation='0.25 0.375 -0.45'>
<Shape> </Shape>
</Transform>
<!-- Blade in -x direction -->
<!-- Rotate 90 - 15 on x -->
<Transform rotation='1 0 0 1.31translation='-0.45 0.375 -0.25'>
<Shape> </Shape>
</Transform>
<!-- Blade in z direction -->
<!-- Rotate 15 degreen on z -->
<Transform rotation='0 0 1 0.26translation='-0.25 0.375 0.45'>
<Shape> </Shape>
</Transform>
</Group>
<LOD range='50 200'>
<Group USE='FourBlades'/>
<Group>
<Transform translation='0 0.45 0'>
<Shape>
<Appearance>
<Material diffuseColor='0.2 0.2 0.2transparency='0.75'/>
</Appearance>
<Cylinder height='0.1radius='6'/>
</Shape>
</Transform>
</Group>
<WorldInfo title='null'/>
</LOD>
</Switch>
<!-- ROUTE information for BladeRotationOnOffScript node:  [from clockEnabled to Clock.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 Clock node:  [from BladeRotationOnOffScript.clockEnabled to set_enabled ] [from fraction_changed to MainRotorPath.set_fraction ] -->
<TimeSensor DEF='Clockenabled='falseloop='true'/>
<!-- Animation Path -->
<!-- ROUTE information for MainRotorPath node:  [from Clock.fraction_changed to set_fraction ] [from value_changed to MainRotor.set_rotation ] -->
<OrientationInterpolator DEF='MainRotorPathkey='0.0 0.25 0.5 0.75 1.0keyValue='0.00 -1.00 0.0 0.0 0.00 -1.00 0.0 1.571 0.00 -1.00 0.0 3.142 0.00 -1.00 0.0 4.712 0.00 -1.00 0.0 6.284'/>
</Transform>
<ROUTE fromNode='BladeRotationOnOffScriptfromField='clockEnabledtoNode='ClocktoField='set_enabled'/>
<ROUTE fromNode='BladeRotationOnOffScriptfromField='switchChoicetoNode='RotationSwitchtoField='whichChoice'/>
<ROUTE fromNode='ClockfromField='fraction_changedtoNode='MainRotorPathtoField='set_fraction'/>
<ROUTE fromNode='MainRotorPathfromField='value_changedtoNode='MainRotortoField='set_rotation'/>
</ProtoBody>
</ProtoDeclare>
<!-- ============================================================ -->
<WorldInfo title='FourBladeMainRotor Prototype'/>
<Background skyColor='0.9 0.9 0.9'/>
<Viewpoint description='Toggle Blade Statusposition='0 1 12'/>
<Viewpoint description='At a distanceposition='0 1 50'/>
<!-- ROUTE information for ExampleMainRotor node:  [from ExampleSelection.status to rotationOn ] -->
<ProtoInstance name='FourBladeMainRotorDEF='ExampleMainRotor'/>
<Transform translation='0 2.5 0'>
<!-- ROUTE information for ExampleBladeRotationToggle node:  [from isActive to ExampleSelection.toggleEnabled ] -->
<TouchSensor DEF='ExampleBladeRotationToggledescription='Toggle blade rotation on/off'/>
<Shape>
<Appearance>
<!-- ROUTE information for ToggleStatusColor node:  [from ExampleSelection.statusColor to diffuseColor ] -->
<Material DEF='ToggleStatusColordiffuseColor='0.6 0.6 0'/>
</Appearance>
<Text string=' "Select Text to Toggle"
"Blade Rotation On/Off"
'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
</Shape>
<Shape>
<Box size='10 2.0 0.01'/>
<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 ExampleMainRotor.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='ExampleMainRotortoField='rotationOn'/>
</Scene>
</X3D>
<!--

Index for ProtoDeclare definition : FourBladeMainRotor

Index for DEF nodes : Arm, Blade, BladeColor, BladeRotationOnOffScript, Clock, ExampleBladeRotationToggle, ExampleMainRotor, ExampleSelection, FourBlades, MainRotor, MainRotorPath, RotationSwitch, ShaftColor, ToggleStatusColor, Tube

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