1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
|
3 | <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'> |
4 | <head> |
5 | <meta name='title' content='ProximitySensorExample.x3d'/> |
6 | <meta name='description' content='Demonstrates use of a ProximitySensor in building a HUD'/> |
7 | <meta name='creator' content='Leonard Daly and Don Brutzman'/> |
8 | <meta name='created' content='15 July 2006'/> |
9 | <meta name='modified' content='27 July 2024'/> |
10 | <meta name='Image' content='ProximitySensorVisualization.png'/> |
11 | <meta name='reference' content='https://X3dGraphics.com'/> |
12 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/X3dResources.html'/> |
13 | <meta name='rights' content='Copyright 2006, Daly Realism and Don Brutzman'/> |
14 | <meta name='subject' content='X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com'/> |
15 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/ProximitySensorExample.x3d'/> |
16 | <meta name='generator' content='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/> |
17 | <meta name='license' content='../license.html'/> |
18 | </head> |
19 | <Scene> |
20 | <!-- HUD = Heads-Up Display, which stays on screen in same relative location even while user navigates --> |
21 | <!-- TODO: authors should use X3D-Edit editing pane to try out the ProximitySensor Visualize capability --> |
22 | <WorldInfo title='ProximitySensorExample.x3d'/> |
23 |
<!-- ROUTE information for HereIAm node:
[from orientation_changed to HUD.rotation
]
[from position_changed to HUD.translation
]
[from position_changed to CnvText.position
]
[from orientation_changed to CnvText.orientation
]
-->
<ProximitySensor DEF='HereIAm' size='100 100 100'/> |
24 | <Inline url=' "../KelpForestExhibit/KelpForestMain.x3d" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpForestMain.x3d" "../KelpForestExhibit/KelpForestMain.wrl" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpForestMain.wrl" '/> |
25 |
<!-- ROUTE information for HUD node:
[from HereIAm.orientation_changed to rotation
]
[from HereIAm.position_changed to translation
]
-->
<Transform DEF='HUD'> |
26 | <Transform DEF='PushBack' translation='-.8 1. -3'> |
27 | <Shape> |
28 | <Appearance> |
29 | <Material diffuseColor='1 1 0'/> |
30 | </Appearance> |
31 | <Box size='1.5 .4 .1'/> |
32 | </Shape> |
33 | <Transform DEF='HudContents' translation='-.7 .3 .1'> |
34 | <Transform DEF='TopText' translation='0 -.2 0'> |
35 | <Shape> |
36 | |
37 | <Material diffuseColor='0 0 0'/> |
38 | </Appearance> |
39 |
<!-- ROUTE information for TopTextLine node:
[from CnvText.positionText to string
]
-->
<Text DEF='TopTextLine' string='"Position 0.00 0.00 10.00"'> |
40 | |
41 | </Text> |
42 | </Shape> |
43 | </Transform> |
44 | <Transform DEF='BottomText' translation='0 -.4 0'> |
45 | <Shape> |
46 | <Appearance USE='Text_app'/> |
47 |
<!-- ROUTE information for BottomTextLine node:
[from CnvText.orientationText to string
]
-->
<Text DEF='BottomTextLine' string='"Orientation: 0.000 1.000 0.000 0.00"'> |
48 | <FontStyle USE='TextStyle'/> |
49 | </Text> |
50 | </Shape> |
51 | </Transform> |
52 | </Transform> |
53 | </Transform> |
54 | </Transform> |
55 |
<!-- ROUTE information for CnvText node:
[from HereIAm.position_changed to position
]
[from HereIAm.orientation_changed to orientation
]
[from positionText to TopTextLine.string
]
[from orientationText to BottomTextLine.string
]
-->
<Script DEF='CnvText' url=' "ProximitySensorScriptConvertText.js" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/ProximitySensorScriptConvertText.js" '> |
56 | <field name='position' type='SFVec3f' accessType='inputOnly'/> |
57 | <field name='orientation' type='SFRotation' accessType='inputOnly'/> |
58 | <field name='positionText' type='MFString' accessType='outputOnly'/> |
59 | <field name='orientationText' type='MFString' accessType='outputOnly'/> |
60 | </Script> |
61 | < ROUTE fromNode='HereIAm' fromField='orientation_changed' toNode='HUD' toField='rotation'/> |
62 | < ROUTE fromNode='HereIAm' fromField='position_changed' toNode='HUD' toField='translation'/> |
63 | < ROUTE fromNode='HereIAm' fromField='position_changed' toNode='CnvText' toField='position'/> |
64 | < ROUTE fromNode='HereIAm' fromField='orientation_changed' toNode='CnvText' toField='orientation'/> |
65 | < ROUTE fromNode='CnvText' fromField='positionText' toNode='TopTextLine' toField='string'/> |
66 | < ROUTE fromNode='CnvText' fromField='orientationText' toNode='BottomTextLine' toField='string'/> |
67 | </Scene> |
68 | </X3D> |
Event Graph ROUTE Table entries with 6 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.
HereIAm
ProximitySensor orientation_changed SFRotation |
HUD
Transform rotation SFRotation |
|||||
HereIAm
ProximitySensor position_changed SFVec3f |
HUD
Transform translation SFVec3f |
|||||
HereIAm
ProximitySensor position_changed SFVec3f |
CnvText
Script position SFVec3f |
then
|
CnvText
Script orientationText MFString |
BottomTextLine
Text string MFString |
||
then
|
CnvText
Script positionText MFString |
TopTextLine
Text string MFString |
||||
HereIAm
ProximitySensor orientation_changed SFRotation |
CnvText
Script orientation SFRotation |
then
|
CnvText
Script orientationText MFString |
BottomTextLine
Text string MFString |
||
then
|
CnvText
Script positionText MFString |
TopTextLine
Text string MFString |
<!--
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)
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->