<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://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 =' https://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='20 October 2019'/>
<meta name='rightscontent='Copyright 2006, Daly Realism and Don Brutzman'/>
<meta name='Imagecontent='UserInteractivitySensorNodes.png' />
<meta name='Imagecontent='UserInteractivitySensorNodesModified.png' />
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/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>
<WorldInfo title='UserInteractivitySensorNodes.x3d'/>
<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=' DefaultTouchSensor' fromField='isActive' toNode=' BackgroundTouchCone' toField='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=' DefaultPlaneSensor' fromField='offset' toNode=' TransformBox' toField='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=' DefaultCylinderSensor' fromField='rotation_changed' toNode=' TransformCylinder' toField='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=' DefaultSphereSensor' fromField='rotation_changed' toNode=' TransformSphere' toField='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'/>

<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.println ('keyInput=' + inputValue); // console output
    keyOutput = new MFString (inputValue); // type conversion
}
function finalTextInput (inputValue)
{
//  Browser.println ('finalText=' + inputValue); // console output
    stringOutput = new MFString (inputValue); // type conversion
}
function enteredTextInput (inputValue)
{
    Browser.println ('enteredText=' + inputValue); // console output
}

      
]]>
</Script>
< ROUTE  fromNode=' DefaultKeySensor' fromField='keyPress' toNode=' KeyboardProcessor' toField='keyInput'/>
< ROUTE  fromNode=' DefaultStringSensor' fromField='finalText' toNode=' KeyboardProcessor' toField='finalTextInput'/>
< ROUTE  fromNode=' DefaultStringSensor' fromField='enteredText' toNode=' KeyboardProcessor' toField='enteredTextInput'/>
< ROUTE  fromNode=' KeyboardProcessor' fromField='keyOutput' toNode=' KeyText' toField='string'/>
< ROUTE  fromNode=' KeyboardProcessor' fromField='stringOutput' toNode=' StringText' toField='string'/>
</Group>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- 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 node: Viewpoint_1
-->

Event Graph ROUTE Table entries with 9 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.

DefaultTouchSensor
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
BackgroundTouchCone
Background
set_bind
SFBool


DefaultStringSensor
StringSensor
finalText
SFString

ROUTE
event to
(1)
KeyboardProcessor
Script
finalTextInput
SFString

 
 
then
KeyboardProcessor
Script
keyOutput
MFString

ROUTE
event to
(2)
KeyText
Text
string
MFString
 
 
 
then
KeyboardProcessor
Script
stringOutput
MFString

ROUTE
event to
(2)
StringText
Text
string
MFString
DefaultStringSensor
StringSensor
enteredText
SFString

ROUTE
event to
(1)
KeyboardProcessor
Script
enteredTextInput
SFString

 
 
then
KeyboardProcessor
Script
keyOutput
MFString

ROUTE
event to
(2)
KeyText
Text
string
MFString
 
 
 
then
KeyboardProcessor
Script
stringOutput
MFString

ROUTE
event to
(2)
StringText
Text
string
MFString


DefaultSphereSensor
SphereSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
TransformSphere
Transform
set_rotation
SFRotation


DefaultPlaneSensor
PlaneSensor
offset
SFVec3f

ROUTE
event to
(1)
TransformBox
Transform
set_translation
SFVec3f


DefaultKeySensor
KeySensor
keyPress
SFString

ROUTE
event to
(1)
KeyboardProcessor
Script
keyInput
SFString

 
 
then
KeyboardProcessor
Script
keyOutput
MFString

ROUTE
event to
(2)
KeyText
Text
string
MFString
 
 
 
then
KeyboardProcessor
Script
stringOutput
MFString

ROUTE
event to
(2)
StringText
Text
string
MFString


DefaultCylinderSensor
CylinderSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
TransformCylinder
Transform
set_rotation
SFRotation


-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter08UserInteractivity/UserInteractivitySensorNodesIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter08UserInteractivity/UserInteractivitySensorNodes.x3d -->

<!-- Color legend: X3D terminology <X3dNode DEF='idName' field='value'/> matches XML terminology <XmlElement DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
-->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->