<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.1//EN"   "http://www.web3d.org/specifications/x3d-3.1.dtd">
<X3D profile='Immersiveversion='3.1xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation=' http://www.web3d.org/specifications/x3d-3.1.xsd '>
<head>
<meta name='titlecontent='UserInteractivitySensorNodes.x3d'/>
<meta name='descriptioncontent='A collection of all of the user interactivity sensor nodes: TouchSensor, PlaceSensor, CylinderSensor, SphereSensor, KeySensor, and StringSensor.'/>
<meta name='creatorcontent='Don Brutzman'/>
<meta name='createdcontent='30 April 2005'/>
<meta name='modifiedcontent='16 February 2008'/>
<meta name='rightscontent='Copyright 2006, Daly Realism and Don Brutzman'/>
<meta name='identifiercontent=' http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter08-UserInteractivity/UserInteractivitySensorNodes.x3d '/>
<meta name='generatorcontent='X3D-Edit, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent='../license.html'/>
</head>
<!--

Index for DEF nodes: BackgroundDefault, BackgroundTouchCone, DarkBlue, DefaultCylinderSensor, DefaultKeySensor, DefaultMaterial, DefaultPlaneSensor, DefaultSphereSensor, DefaultStringSensor, DefaultTouchSensor, GreenAppearance, JustifyMiddle, KeyboardProcessor, KeyText, LightBrownAppearance, RedAppearance, ReferenceTexture, SphereSensorText, StringText, TransformBox, TransformCylinder, TransformSphere
Index for Viewpoint image: Viewpoint_1
-->
<Scene>
<Viewpoint description='User interactivity sensor nodesposition='0 0 12'/>
<Background DEF='BackgroundDefaultgroundColor='0.2 0.4 0.6skyColor='0.2 0.4 0.6'/>
<!-- BackgroundTouchCone ROUTE:  [from DefaultTouchSensor.isActive to set_bind ] -->
<Background DEF='BackgroundTouchConeskyColor='0.5 0.7 0.9'/>
<Transform translation='0 4 0'>
<Shape>
<Text string='Sensor node examplessolid='true'>
<FontStyle justify='"MIDDLE" "MIDDLE"size='1.5'/>
</Text>
<Appearance>
<Material DEF='DefaultMaterialdiffuseColor='0.8 0.6 0.4'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='0 1 0'>
<Transform translation='-6 0 0'>
<!-- DefaultTouchSensor ROUTE:  [from isActive to BackgroundTouchCone.set_bind ] -->
<TouchSensor DEF='DefaultTouchSensordescription='click to activate TouchSensor bind alternate Background'/>
<Shape>
<Cone/>
<Appearance DEF='RedAppearance'>
<Material diffuseColor='1 0.2 0.2'/>
</Appearance>
</Shape>
<Transform translation='0 -2 0'>
<Shape>
<Text solid='falsestring='"Touch" "Sensor"'>
<FontStyle DEF='JustifyMiddlejustify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance USE='RedAppearance'/>
</Shape>
</Transform>
<ROUTE fromNode='DefaultTouchSensorfromField='isActivetoNode='BackgroundTouchConetoField='set_bind'/>
</Transform>
<!-- TransformBox ROUTE:  [from DefaultPlaneSensor.offset to set_translation ] -->
<Transform DEF='TransformBoxtranslation='-2 0 0'>
<!-- DefaultPlaneSensor ROUTE:  [from offset to TransformBox.set_translation ] -->
<PlaneSensor DEF='DefaultPlaneSensordescription='drag Box to activate PlaneSensor'/>
<Shape>
<Box/>
<Appearance DEF='GreenAppearance'>
<Material diffuseColor='0.2 1 0.2'/>
</Appearance>
</Shape>
<Transform translation='0 -2 0'>
<Shape>
<Text solid='falsestring='"Plane" "Sensor"'>
<FontStyle USE='JustifyMiddle'/>
</Text>
<Appearance USE='GreenAppearance'/>
</Shape>
</Transform>
<ROUTE fromNode='DefaultPlaneSensorfromField='offsettoNode='TransformBoxtoField='set_translation'/>
</Transform>
<!-- TransformCylinder ROUTE:  [from DefaultCylinderSensor.rotation_changed to set_rotation ] -->
<Transform DEF='TransformCylindertranslation='2 0 0'>
<!-- DefaultCylinderSensor ROUTE:  [from rotation_changed to TransformCylinder.set_rotation ] -->
<CylinderSensor DEF='DefaultCylinderSensordescription='drag to activate CylinderSensor'/>
<Shape>
<Cylinder/>
<Appearance> </Appearance>
</Shape>
<Transform translation='0 -2 0'>
<Shape>
<Text solid='falsestring='"Cylinder" "Sensor"'>
<FontStyle USE='JustifyMiddle'/>
</Text>
<Appearance>
<Material USE='DarkBlue'/>
</Appearance>
</Shape>
</Transform>
<ROUTE fromNode='DefaultCylinderSensorfromField='rotation_changedtoNode='TransformCylindertoField='set_rotation'/>
</Transform>
<!-- TransformSphere ROUTE:  [from DefaultSphereSensor.rotation_changed to set_rotation ] -->
<Transform DEF='TransformSpheretranslation='6 0 0'>
<!-- DefaultSphereSensor ROUTE:  [from rotation_changed to TransformSphere.set_rotation ] -->
<SphereSensor DEF='DefaultSphereSensordescription='click to activate SphereSensor'/>
<Shape>
<Sphere/>
<Appearance>
<ImageTexture USE='ReferenceTexture'/>
</Appearance>
</Shape>
<Transform DEF='SphereSensorTexttranslation='0 -2 0'>
<Shape>
<Text solid='falsestring='"Sphere" "Sensor"'>
<FontStyle USE='JustifyMiddle'/>
</Text>
</Shape>
</Transform>
<ROUTE fromNode='DefaultSphereSensorfromField='rotation_changedtoNode='TransformSpheretoField='set_rotation'/>
</Transform>
</Transform>
<Group>
<Transform translation='-4 -3 0'>
<Shape>
<!-- KeyText ROUTE:  [from KeyboardProcessor.keyOutput to string ] -->
<Text DEF='KeyTextsolid='falsestring='?'>
<FontStyle USE='JustifyMiddle'/>
</Text>
<Appearance DEF='LightBrownAppearance'>
<Material diffuseColor='1 0.862745 0.141176'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='-2 -3 0'>
<Shape>
<!-- StringText ROUTE:  [from KeyboardProcessor.stringOutput to string ] -->
<Text DEF='StringTextsolid='falsestring='Press keys then <Enter>'>
<FontStyle justify='"BEGIN" "MIDDLE"'/>
</Text>
<Appearance USE='LightBrownAppearance'/>
</Shape>
</Transform>
<!-- DefaultKeySensor ROUTE:  [from keyPress to KeyboardProcessor.keyInput ] -->
<KeySensor DEF='DefaultKeySensorenabled='true'/>
<!-- DefaultStringSensor ROUTEs:  [from finalText to KeyboardProcessor.finalTextInput ] [from enteredText to KeyboardProcessor.enteredTextInput ] -->
<StringSensor DEF='DefaultStringSensordeletionAllowed='trueenabled='true'/>
<!-- KeyboardProcessor ROUTEs:  [from DefaultKeySensor.keyPress to keyInput ] [from DefaultStringSensor.finalText to finalTextInput ] [from DefaultStringSensor.enteredText to enteredTextInput ] [from keyOutput to KeyText.string ] [from stringOutput to StringText.string ] -->
<Script DEF='KeyboardProcessor'>
<field name='keyInputtype='SFStringaccessType='inputOnly'/>
<field name='finalTextInputtype='SFStringaccessType='inputOnly'/>
<field name='enteredTextInputtype='SFStringaccessType='inputOnly'/>
<field name='keyOutputtype='MFStringaccessType='outputOnly'/>
<field name='stringOutputtype='MFStringaccessType='outputOnly'/>
<![CDATA[
        
ecmascript:

function keyInput (inputValue)
{
//  Browser.print ('keyInput=' + inputValue + '\n'); // console output
    keyOutput = new MFString (inputValue); // type conversion
}
function finalTextInput (inputValue)
{
//  Browser.print ('finalText=' + inputValue + '\n'); // console output
    stringOutput = new MFString (inputValue); // type conversion
}
function enteredTextInput (inputValue)
{
    Browser.print ('enteredText=' + inputValue + '\n'); // console output
}

      
]]>
</Script>
<ROUTE fromNode='DefaultKeySensorfromField='keyPresstoNode='KeyboardProcessortoField='keyInput'/>
<ROUTE fromNode='DefaultStringSensorfromField='finalTexttoNode='KeyboardProcessortoField='finalTextInput'/>
<ROUTE fromNode='DefaultStringSensorfromField='enteredTexttoNode='KeyboardProcessortoField='enteredTextInput'/>
<ROUTE fromNode='KeyboardProcessorfromField='keyOutputtoNode='KeyTexttoField='string'/>
<ROUTE fromNode='KeyboardProcessorfromField='stringOutputtoNode='StringTexttoField='string'/>
</Group>
</Scene>
</X3D>
<!--

Index for DEF nodes: BackgroundDefault, BackgroundTouchCone, DarkBlue, DefaultCylinderSensor, DefaultKeySensor, DefaultMaterial, DefaultPlaneSensor, DefaultSphereSensor, DefaultStringSensor, DefaultTouchSensor, GreenAppearance, JustifyMiddle, KeyboardProcessor, KeyText, LightBrownAppearance, RedAppearance, ReferenceTexture, SphereSensorText, StringText, TransformBox, TransformCylinder, TransformSphere
Index for Viewpoint image: Viewpoint_1
-->

<!-- Tag color codes: <Node DEF='idName' attribute='value'/> -->