<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://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 =' http://www.web3d.org/specifications/x3d-3.3.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='8 January 2014'/>
<meta name='rightscontent='Copyright 2006, Daly Realism and Don Brutzman'/>
<meta name='Imagecontent='UserInteractivitySensorNodes.png'/>
<meta name='Imagecontent='UserInteractivitySensorNodesModified.png'/>
<meta name='identifiercontent=' http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter08UserInteractivity/UserInteractivitySensorNodes.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<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'/>
<!-- ROUTE information for BackgroundTouchCone node:  [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 examples"'>
<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'>
<!-- ROUTE information for DefaultTouchSensor node:  [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 string='"Touch" "Sensor"'>
<FontStyle DEF='JustifyMiddlejustify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance USE='RedAppearance'/>
</Shape>
</Transform>
<ROUTE fromNode='DefaultTouchSensorfromField='isActivetoNode='BackgroundTouchConetoField='set_bind'/>
</Transform>
<!-- ROUTE information for TransformBox node:  [from DefaultPlaneSensor.offset to set_translation ] -->
<Transform DEF='TransformBoxtranslation='-2 0 0'>
<!-- ROUTE information for DefaultPlaneSensor node:  [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 string='"Plane" "Sensor"'>
<FontStyle USE='JustifyMiddle'/>
</Text>
<Appearance USE='GreenAppearance'/>
</Shape>
</Transform>
<ROUTE fromNode='DefaultPlaneSensorfromField='offsettoNode='TransformBoxtoField='set_translation'/>
</Transform>
<!-- ROUTE information for TransformCylinder node:  [from DefaultCylinderSensor.rotation_changed to set_rotation ] -->
<Transform DEF='TransformCylindertranslation='2 0 0'>
<!-- ROUTE information for DefaultCylinderSensor node:  [from rotation_changed to TransformCylinder.set_rotation ] -->
<CylinderSensor DEF='DefaultCylinderSensordescription='drag to activate CylinderSensor'/>
<Shape> </Shape>
<Transform translation='0 -2 0'>
<Shape>
<Text string='"Cylinder" "Sensor"'>
<FontStyle USE='JustifyMiddle'/>
</Text>
<Appearance>
<Material USE='DarkBlue'/>
</Appearance>
</Shape>
</Transform>
<ROUTE fromNode='DefaultCylinderSensorfromField='rotation_changedtoNode='TransformCylindertoField='set_rotation'/>
</Transform>
<!-- ROUTE information for TransformSphere node:  [from DefaultSphereSensor.rotation_changed to set_rotation ] -->
<Transform DEF='TransformSpheretranslation='6 0 0'>
<!-- ROUTE information for DefaultSphereSensor node:  [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 string='"Sphere" "Sensor"'>
<FontStyle USE='JustifyMiddle'/>
</Text>
<Appearance>
<Material DEF='GreyMaterial'/>
</Appearance>
</Shape>
</Transform>
<ROUTE fromNode='DefaultSphereSensorfromField='rotation_changedtoNode='TransformSpheretoField='set_rotation'/>
</Transform>
</Transform>
<Group>
<Transform translation='-4 -3 0'>
<Shape>
<!-- ROUTE information for KeyText node:  [from KeyboardProcessor.keyOutput to string ] -->
<Text DEF='KeyTextstring='"?"'>
<FontStyle USE='JustifyMiddle'/>
</Text>
<Appearance DEF='LightBrownAppearance'>
<Material diffuseColor='1 0.862745 0.141176'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='-2 -3 0'>
<Shape>
<!-- ROUTE information for StringText node:  [from KeyboardProcessor.stringOutput to string ] -->
<Text DEF='StringTextstring='"Press keys then <Enter>"'>
<FontStyle justify='"BEGIN" "MIDDLE"'/>
</Text>
<Appearance USE='LightBrownAppearance'/>
</Shape>
</Transform>
<!-- ROUTE information for DefaultKeySensor node:  [from keyPress to KeyboardProcessor.keyInput ] -->
<KeySensor DEF='DefaultKeySensor'/>
<!-- ROUTE information for DefaultStringSensor node:  [from finalText to KeyboardProcessor.finalTextInput ] [from enteredText to KeyboardProcessor.enteredTextInput ] -->
<StringSensor DEF='DefaultStringSensor'/>
<!-- ROUTE information for KeyboardProcessor node:  [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, GreyMaterial, JustifyMiddle, KeyboardProcessor, KeyText, LightBrownAppearance, RedAppearance, ReferenceTexture, SphereSensorText, StringText, TransformBox, TransformCylinder, TransformSphere

Index for Viewpoint image : Viewpoint_1
-->

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