<?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='RearHatch.x3d'/>
<meta name='descriptioncontent='Osprey MV-22 rear hatch.'/>
<meta name='creatorcontent='Major William C. James USMC'/>
<meta name='createdcontent='23 September 2001'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='referencecontent='Amended from VRML Sourcebook Figure 8.4 (used as base)'/>
<meta name='referencecontent=' http://www.navair.navy.mil/v22 '/>
<meta name='identifiercontent=' https://savage.nps.edu/Savage/AircraftFixedWing/Mv22OspreyUnitedStates/RearHatch.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo title='RearHatch.x3d'/>
<Background skyColor='.2 .2 .7'/>
<!-- ROUTE information for ToggleScript node:  [from RearHatchSensor.isActive to toggle ] [from stateTurnedTrue to TimeFilter.setStart ] [from stateTurnedTrue to TimeFilter.setStop ] -->
<Script DEF='ToggleScript'>
<field name='toggletype='SFBoolaccessType='inputOnly'/>
<field name='statetype='SFBoolaccessType='initializeOnly'/>
<field name='stateTurnedTruetype='SFBoolaccessType='outputOnly'/>
<field name='stateTurnedFalsetype='SFBoolaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:

// setting the value of an eventOut variable also sends it as an event
// you can view the output of print statements in the VRML Console

function toggle ( value, ts ) {
  // only toggle on click (isActive true) not release (isActive false)
  if ( value == false ) return;
  if ( state == true )
  {
	state  = false;
	stateTurnedFalse = true;
	Browser.print ('ToggleScript.state = ' + state + ', stateTurnedFalse = ' + true);
  }
  else
  {
	state  = true;
	stateTurnedTrue = true;
	Browser.print ('ToggleScript.state = ' + state + ', stateTurnedTrue = ' + true);
  }
}

    
]]>
</Script>
<!-- ROUTE information for TimeFilter node:  [from ToggleScript.stateTurnedTrue to setStart ] [from ToggleScript.stateTurnedTrue to setStop ] [from startEventTime to CLOCK1.set_startTime ] [from startEventTime to CLOCK2.set_startTime ] -->
<Script DEF='TimeFilter'>
<field name='setStarttype='SFBoolaccessType='inputOnly'/>
<field name='setStoptype='SFBoolaccessType='inputOnly'/>
<field name='startEventTimetype='SFTimeaccessType='outputOnly'/>
<field name='stopEventTimetype='SFTimeaccessType='outputOnly'/>
<![CDATA[
      
ecmascript:

// setting the value of an eventOut variable also sends it as an event

function setStart ( value, timeStamp ) {
	startEventTime = timeStamp;
	Browser.print ('TimeFilter.setStart (' + value + '), startEventTime = ' + timeStamp);
	Browser.print (' ');
}
function setStop  ( value, timeStamp ) {
	stopEventTime  = timeStamp;
	Browser.print ('TimeFilter.setStop  (' + value + '),  stopEventTime = ' + timeStamp);
	Browser.print (' ');
}

    
]]>
</Script>
<!-- Rear Hatch -->
<Group DEF='Rear_HatchbboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Transform DEF='RearHatchTransformrotation='0 0 -1 1.57translation='0 -4.6 -6.2bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Group DEF='RearHatchbboxCenter='0 0 0bboxSize='-1 -1 -1'>
<!-- ROUTE information for RearHatchRotationSupport node:  [from RearHatchInterpolator.value_changed to set_rotation ] [from RearHatchInterpolator1.value_changed to set_rotation ] -->
<Transform DEF='RearHatchRotationSupportrotation='0 1 0 .45bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Shape DEF='RotatingBarbboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Cylinder height='3.9radius='.2'/>
<Appearance>
<Material diffuseColor='.5 .5 .5shininess='.5'/>
</Appearance>
</Shape>
<Transform DEF='HatchbboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Transform rotation='0 0 -1 1.57translation='0 0 -2.5bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Box size='3.85 .2 5solid='true'/>
<Appearance>
<Material diffuseColor='.5 .5 .5shininess='.5'/>
</Appearance>
</Shape>
</Transform>
</Transform>
</Transform>
</Group>
</Transform>
<!-- ROUTE information for RearHatchSensor node:  [from touchTime to CLOCK1.set_startTime ] [from isActive to ToggleScript.toggle ] -->
<TouchSensor DEF='RearHatchSensordescription='touch to open'/>
<!-- ROUTE information for CLOCK1 node:  [from RearHatchSensor.touchTime to set_startTime ] [from TimeFilter.startEventTime to set_startTime ] [from fraction_changed to RearHatchInterpolator.set_fraction ] -->
<TimeSensor DEF='CLOCK1cycleInterval='4'/>
<!-- ROUTE information for RearHatchInterpolator node:  [from CLOCK1.fraction_changed to set_fraction ] [from value_changed to RearHatchRotationSupport.set_rotation ] -->
<OrientationInterpolator DEF='RearHatchInterpolatorkey='0.0 1.0keyValue='0.0 1.0 0.0 0.45 0.0 1.0 0.0 -0.2'/>
<!-- Up_Ramp -->
<!-- ROUTE information for CLOCK2 node:  [from TimeFilter.startEventTime to set_startTime ] [from fraction_changed to RearHatchInterpolator1.set_fraction ] -->
<TimeSensor DEF='CLOCK2cycleInterval='4'/>
<!-- ROUTE information for RearHatchInterpolator1 node:  [from CLOCK2.fraction_changed to set_fraction ] [from value_changed to RearHatchRotationSupport.set_rotation ] -->
<OrientationInterpolator DEF='RearHatchInterpolator1key='0.0 1.0keyValue='0.0 1.0 0.0 -.2 0.0 1.0 0.0 0.45'/>
</Group>
<!-- Down_Ramp_Code -->
<ROUTE fromNode='RearHatchSensorfromField='touchTimetoNode='CLOCK1toField='set_startTime'/>
<ROUTE fromNode='CLOCK1fromField='fraction_changedtoNode='RearHatchInterpolatortoField='set_fraction'/>
<ROUTE fromNode='RearHatchInterpolatorfromField='value_changedtoNode='RearHatchRotationSupporttoField='set_rotation'/>
<!-- Toggle_Code -->
<ROUTE fromNode='RearHatchSensorfromField='isActivetoNode='ToggleScripttoField='toggle'/>
<ROUTE fromNode='RearHatchInterpolator1fromField='value_changedtoNode='RearHatchRotationSupporttoField='set_rotation'/>
<!-- Up_Ramp_Code -->
<ROUTE fromNode='CLOCK2fromField='fraction_changedtoNode='RearHatchInterpolator1toField='set_fraction'/>
<ROUTE fromNode='ToggleScriptfromField='stateTurnedTruetoNode='TimeFiltertoField='setStart'/>
<ROUTE fromNode='ToggleScriptfromField='stateTurnedTruetoNode='TimeFiltertoField='setStop'/>
<ROUTE fromNode='TimeFilterfromField='startEventTimetoNode='CLOCK1toField='set_startTime'/>
<ROUTE fromNode='TimeFilterfromField='startEventTimetoNode='CLOCK2toField='set_startTime'/>
</Scene>
</X3D>
<!--

Index for DEF nodes : CLOCK1, CLOCK2, Hatch, Rear_Hatch, RearHatch, RearHatchInterpolator, RearHatchInterpolator1, RearHatchRotationSupport, RearHatchSensor, RearHatchTransform, RotatingBar, TimeFilter, ToggleScript
-->

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

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