| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "https://www.web3d.org/specifications/x3d-3.2.dtd">
|
| 3 | <X3D profile='Immersive' version='3.2' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.2.xsd'> |
| 4 | <head> |
| 5 | <meta name='title' content=' TestPositionFollower.x3d '/> |
| 6 | <meta name='description' content='X3D Follower example'/> |
| 7 | <meta name='creator' content='Herbert Stocker'/> |
| 8 | <meta name='translator' content='Don Brutzman'/> |
| 9 | <meta name='created' content='18 April 2006'/> |
| 10 | <meta name='translated' content='2 December 2011'/> |
| 11 | <meta name='modified' content='20 October 2019'/> |
| 12 | <meta name='reference' content='originals/test_PosFollower.wrl'/> |
| 13 | <meta name='reference' content=' Stocker_06_Followers.pdf '/> |
| 14 | <meta name='reference' content='http://www.hersto.com/Publications/Followers'/> |
| 15 | <meta name='requires' content='X3D version 3.2 or greater'/> |
| 16 | <meta name='subject' content='X3D Follower Chaser Damper'/> |
| 17 | <meta name=' warning ' content=' under development, instantReality works but BS Contact fails silently '/> |
| 18 | <meta name='reference' content=' https://www.web3d.org/x3d/specifications/ISO-IEC-19775-1.2-X3D-AbstractSpecification/Part01/components/followers.html '/> |
| 19 | <meta name='reference' content=' https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html '/> |
| 20 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Basic/Followers/TestPositionFollower.x3d '/> |
| 21 | <meta name='generator' content=' Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html '/> |
| 22 | <meta name='generator' content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 23 | <meta name='license' content='../../license.html'/> |
| 24 | </head> |
| 25 | <Scene> |
| 26 | <WorldInfo title='TestPositionFollower.x3d'/> |
| 27 | <Viewpoint description='TestPositionFollower' fieldOfView='0.716' position='0.0 0.0 15.0'/> |
| 28 | <NavigationInfo type='"NONE"'/> |
| 29 | <Group> |
| 30 |
<!-- ROUTE information for PlaneSensorPosition node:
[from trackPoint_changed to TrObjectDirect.translation
]
[from trackPoint_changed to PositionDamperNode.set_destination
]
[from trackPoint_changed to PositionChaserNode.set_destination
]
-->
<PlaneSensor DEF='PlaneSensorPosition' description='touch to activate'/> |
| 31 | <Transform translation='0.0 0.0 -0.05'> |
| 32 | <Shape> |
| 33 | <Appearance> |
| 34 | <Material ambientIntensity='0.0333' diffuseColor='0.0 0.0 0.0' emissiveColor='0.177 0.19 0.208' shininess='0.54'/> |
| 35 | </Appearance> |
| 36 | <Box size='10.0 10.0 0.1'/> |
| 37 | </Shape> |
| 38 | </Transform> |
| 39 | </Group> |
| 40 |
<!-- ROUTE information for TrObjectDirect node:
[from PlaneSensorPosition.trackPoint_changed to translation
]
-->
<Transform DEF='TrObjectDirect' scale='0.8 0.8 0.8'> |
| 41 | <Shape> |
| 42 | <Appearance> |
| 43 | <Material ambientIntensity='0.0333' diffuseColor='0.02 0.24 0.53' emissiveColor='0.01 0.12 0.27' shininess='0.54' specularColor='0.32 0.4 0.4'/> |
| 44 | </Appearance> |
| 45 |
<!-- Sphere
GeomObject is a DEF node that has 2 USE nodes: USE_1, USE_2 --> <Sphere DEF='GeomObject' radius='0.3'/> |
| 46 | </Shape> |
| 47 | </Transform> |
| 48 | < ROUTE fromNode='PlaneSensorPosition' fromField='trackPoint_changed' toNode='TrObjectDirect' toField='translation'/> |
| 49 |
<!-- ROUTE information for SwObjectDampered node:
[from ScrBtnMgr.WcDamper to whichChoice
]
-->
<Switch DEF='SwObjectDampered' whichChoice='0'> |
| 50 |
<!-- ROUTE information for TrObjectDampered node:
[from PositionDamperNode.value_changed to translation
]
[from translation to ScrTrailer.DamperPos
]
-->
<Transform DEF='TrObjectDampered'> |
| 51 | <Shape> |
| 52 |
<!-- Appearance
AppObjectDampered is a DEF node that has 1 USE node: USE_1 -->
<Appearance DEF='AppObjectDampered'> |
| 53 | <Material ambientIntensity='0.0333' diffuseColor='0.53 0.02 0.24' emissiveColor='0.27 0.01 0.12' shininess='0.54' specularColor='0.4 0.32 0.4'/> |
| 54 | </Appearance> |
| 55 | <Sphere USE='GeomObject'/> |
| 56 | </Shape> |
| 57 | </Transform> |
| 58 | </Switch> |
| 59 |
<!-- ROUTE information for PositionDamperNode node:
[from PlaneSensorPosition.trackPoint_changed to set_destination
]
[from value_changed to TrObjectDampered.translation
]
-->
<PositionDamper DEF='PositionDamperNode' containerField='children'/> |
| 60 | < ROUTE fromNode='PlaneSensorPosition' fromField='trackPoint_changed' toNode='PositionDamperNode' toField='set_destination'/> |
| 61 | < ROUTE fromNode='PositionDamperNode' fromField='value_changed' toNode='TrObjectDampered' toField='translation'/> |
| 62 |
<!-- ROUTE information for SwObjectFollowed node:
[from ScrBtnMgr.WcChaser to whichChoice
]
-->
<Switch DEF='SwObjectFollowed' whichChoice='0'> |
| 63 |
<!-- ROUTE information for TrObjectFollowed node:
[from PositionChaserNode.value_changed to translation
]
[from translation to ScrTrailer.ChaserPos
]
-->
<Transform DEF='TrObjectFollowed'> |
| 64 | <Shape> |
| 65 |
<!-- Appearance
AppObjectFollowed is a DEF node that has 1 USE node: USE_1 -->
<Appearance DEF='AppObjectFollowed'> |
| 66 | <Material ambientIntensity='0.0333' diffuseColor='0.24 0.53 0.02' emissiveColor='0.12 0.27 0.01' shininess='0.54' specularColor='0.4 0.4 0.32'/> |
| 67 | </Appearance> |
| 68 | <Sphere USE='GeomObject'/> |
| 69 | </Shape> |
| 70 | </Transform> |
| 71 | </Switch> |
| 72 |
<!-- ROUTE information for PositionChaserNode node:
[from PlaneSensorPosition.trackPoint_changed to set_destination
]
[from value_changed to TrObjectFollowed.translation
]
-->
<PositionChaser DEF='PositionChaserNode' duration='1.5' containerField='children'/> |
| 73 | < ROUTE fromNode='PlaneSensorPosition' fromField='trackPoint_changed' toNode='PositionChaserNode' toField='set_destination'/> |
| 74 | < ROUTE fromNode='PositionChaserNode' fromField='value_changed' toNode='TrObjectFollowed' toField='translation'/> |
| 75 | <ProtoDeclare name='ToggleButton'> |
| 76 | <ProtoInterface> |
| 77 | <field name='HottColor' type='SFColor' value='0.8 0.8 0.3' accessType='initializeOnly'/> |
| 78 | <field name='initiallyOn' type='SFBool' value='false' accessType='initializeOnly'/> |
| 79 | <field name='ColdColor' type='SFColor' value='0.2 0.2 0.0' accessType='initializeOnly'/> |
| 80 | <field name='isOn' type='SFBool' accessType='outputOnly'/> |
| 81 | </ProtoInterface> |
| 82 | <ProtoBody> |
| 83 | <Transform scale='0.4 0.4 0.4'> |
| 84 | <TouchSensor DEF='TouchPosition' description='move ball to demonstrate PositionChaser2D, PositionDamper2D'/> |
| 85 | <Shape DEF='ShRect'> |
| 86 | <Appearance> |
| 87 | <Material DEF='Mat' ambientIntensity='0.04' diffuseColor='0.0 0.0 0.0' shininess='0.11'/> |
| 88 | </Appearance> |
| 89 | <IndexedFaceSet coordIndex='0 1 2 3 -1'> |
| 90 | <Coordinate point='-1 -1 0 1 -1 0 1 1 0 -1 1 0'/> |
| 91 | </IndexedFaceSet> |
| 92 | </Shape> |
| 93 | </Transform> |
| 94 | <Script DEF='ScrToggleButton'> |
| 95 | <field name='TS_Touched' type='SFTime' accessType='inputOnly'/> |
| 96 | <field name='Color' type='SFColor' accessType='outputOnly'/> |
| 97 | <field name='isOn' type='SFBool' accessType='outputOnly'/> |
| 98 | <field name='ColdColor' type='SFColor' accessType='initializeOnly'/> |
| 99 | <field name='Tau' type='SFFloat' accessType='outputOnly'/> |
| 100 | <field name='initiallyOn' type='SFBool' accessType='initializeOnly'/> |
| 101 | <field name='DamperSThere' type='SFBool' accessType='inputOnly'/> |
| 102 | <field name='HottColor' type='SFColor' accessType='initializeOnly'/> |
| 103 | <IS> |
| 104 | <connect nodeField='isOn' protoField='isOn'/> |
| 105 | <connect nodeField='ColdColor' protoField='ColdColor'/> |
| 106 | <connect nodeField='initiallyOn' protoField='initiallyOn'/> |
| 107 | <connect nodeField='HottColor' protoField='HottColor'/> |
| 108 | </IS> |
<![CDATA[
ecmascript:
function DamperSThere()
{
activate(initiallyOn);
}
function activate(a)
{
isOn= a;
Tau= a? .1 : .2;
Color= a? HottColor : ColdColor;
}
function set_id(i)
{
id= i;
}
function TS_Touched()
{
activate(!isOn);
}
]]>
|
|
| 110 | </Script> |
| 111 | <ColorDamper DEF='ColorDamperNode' order='1' containerField='children'/> |
| 112 | </ProtoBody> |
| 113 | </ProtoDeclare> |
| 114 | <Transform translation='-5.7 4.0 0.0'> |
| 115 |
<!-- ROUTE information for BtnDamper node:
[from isOn to ScrBtnMgr.BtnDamperIsOn
]
-->
<ProtoInstance name='ToggleButton' DEF='BtnDamper'> |
| 116 | <fieldValue name='HottColor' value='0.8 0.03 0.36'/> |
| 117 | <fieldValue name='initiallyOn' value='true'/> |
| 118 | <fieldValue name='ColdColor' value='0.2 0.0080 0.09'/> |
| 119 | </ProtoInstance> |
| 120 | </Transform> |
| 121 | <Transform translation='-8.0 3.9 0.0'> |
| 122 | <Shape> |
| 123 | |
| 124 | <Material diffuseColor='0.0 0.0 0.0' emissiveColor='0.8 0.8 0.8'/> |
| 125 | </Appearance> |
| 126 | <Text string='"Damper"'> |
| 127 | |
| 128 | </Text> |
| 129 | </Shape> |
| 130 | </Transform> |
| 131 | <Transform translation='-5.7 2.8 0.0'> |
| 132 |
<!-- ROUTE information for BtnChaser node:
[from isOn to ScrBtnMgr.BtnChaserIsOn
]
-->
<ProtoInstance name='ToggleButton' DEF='BtnChaser'> |
| 133 | <fieldValue name='HottColor' value='0.36 0.8 0.03'/> |
| 134 | <fieldValue name='initiallyOn' value='true'/> |
| 135 | <fieldValue name='ColdColor' value='0.09 0.2 0.0080'/> |
| 136 | </ProtoInstance> |
| 137 | </Transform> |
| 138 | <Transform translation='-8.0 2.7 0.0'> |
| 139 | <Shape> |
| 140 | <Appearance USE='AppLabels'/> |
| 141 | <Text string='"Chaser"'> |
| 142 | <FontStyle USE='FntLabels'/> |
| 143 | </Text> |
| 144 | </Shape> |
| 145 | </Transform> |
| 146 |
<!-- ROUTE information for ScrBtnMgr node:
[from BtnDamper.isOn to BtnDamperIsOn
]
[from BtnChaser.isOn to BtnChaserIsOn
]
[from WcDamper to SwObjectDampered.whichChoice
]
[from WcChaser to SwObjectFollowed.whichChoice
]
[from WcDamper to SwDamperTrail.whichChoice
]
[from WcChaser to SwChaserTrail.whichChoice
]
-->
<Script DEF='ScrBtnMgr'> |
| 147 | <field name='BtnChaserIsOn' type='SFBool' accessType='inputOnly'/> |
| 148 | <field name='WcDamper' type='SFInt32' accessType='outputOnly'/> |
| 149 | <field name='WcChaser' type='SFInt32' accessType='outputOnly'/> |
| 150 | <field name='BtnDamperIsOn' type='SFBool' accessType='inputOnly'/> |
<![CDATA[
ecmascript:
function BtnDamperIsOn(on)
{
WcDamper= on? 0:-1;
}
function BtnChaserIsOn(on)
{
WcChaser= on? 0:-1;
}
]]>
|
|
| 152 | </Script> |
| 153 | < ROUTE fromNode='BtnDamper' fromField='isOn' toNode='ScrBtnMgr' toField='BtnDamperIsOn'/> |
| 154 | < ROUTE fromNode='BtnChaser' fromField='isOn' toNode='ScrBtnMgr' toField='BtnChaserIsOn'/> |
| 155 | < ROUTE fromNode='ScrBtnMgr' fromField='WcDamper' toNode='SwObjectDampered' toField='whichChoice'/> |
| 156 | < ROUTE fromNode='ScrBtnMgr' fromField='WcChaser' toNode='SwObjectFollowed' toField='whichChoice'/> |
| 157 |
<!-- ROUTE information for SwDamperTrail node:
[from ScrBtnMgr.WcDamper to whichChoice
]
-->
<Switch DEF='SwDamperTrail' whichChoice='0'> |
| 158 |
<!-- Group
GrDamperTrail is a DEF node that has 1 USE node: USE_1 --> <Group DEF='GrDamperTrail'/> |
| 159 | </Switch> |
| 160 |
<!-- ROUTE information for SwChaserTrail node:
[from ScrBtnMgr.WcChaser to whichChoice
]
-->
<Switch DEF='SwChaserTrail' whichChoice='0'> |
| 161 |
<!-- Group
GrChaserTrail is a DEF node that has 1 USE node: USE_1 --> <Group DEF='GrChaserTrail'/> |
| 162 | </Switch> |
| 163 |
<!-- ROUTE information for TmrTrail node:
[from cycleTime to ScrTrailer.Tick
]
-->
<TimeSensor DEF='TmrTrail' cycleInterval='0.020000000000000004' loop='true'/> |
| 164 |
<!-- ROUTE information for ScrTrailer node:
[from TmrTrail.cycleTime to Tick
]
[from TrObjectDampered.translation to DamperPos
]
[from TrObjectFollowed.translation to ChaserPos
]
-->
<Script DEF='ScrTrailer' directOutput='true'> |
| 165 | <field name='cShapeDamperTrailPoint' type='SFNode' accessType='initializeOnly'> |
| 166 | <Shape> |
| 167 | <Appearance USE='AppObjectDampered'/> |
| 168 | |
| 169 | </Shape> |
| 170 | </field> |
| 171 | <field name='lastDamperPos' type='SFVec3f' value='0.0 0.0 0.0' accessType='initializeOnly'/> |
| 172 | <field name='ChaserTrails' type='MFNode' accessType='initializeOnly'> |
| 173 | <!-- no initialization nodes since this is a local field to hold content --> |
| 174 | </field> |
| 175 | <field name='cShapeChaserTrailPoint' type='SFNode' accessType='initializeOnly'> |
| 176 | <Shape> |
| 177 | <Appearance USE='AppObjectFollowed'/> |
| 178 | <Sphere USE='GeomTrail'/> |
| 179 | </Shape> |
| 180 | </field> |
| 181 | <field name='DamperTrails' type='MFNode' accessType='initializeOnly'> |
| 182 | <!-- no initialization nodes since this is a local field to hold content --> |
| 183 | </field> |
| 184 | <field name='GrChaserTrail' type='SFNode' accessType='initializeOnly'> |
| 185 | <Group USE='GrChaserTrail'/> |
| 186 | </field> |
| 187 | <field name='ChaserPos' type='SFVec3f' accessType='inputOnly'/> |
| 188 | <field name='cNumTrailPoints' type='SFInt32' value='35' accessType='initializeOnly'/> |
| 189 | <field name='lastChaserPos' type='SFVec3f' value='0.0 0.0 0.0' accessType='initializeOnly'/> |
| 190 | <field name='Tick' type='SFTime' accessType='inputOnly'/> |
| 191 | <field name='DamperPos' type='SFVec3f' accessType='inputOnly'/> |
| 192 | <field name='GrDamperTrail' type='SFNode' accessType='initializeOnly'> |
| 193 | <Group USE='GrDamperTrail'/> |
| 194 | </field> |
<![CDATA[
ecmascript:
function initialize()
{
DamperTrails.length=
ChaserTrails.length= cNumTrailPoints;
for(var C= 0; C<cNumTrailPoints; C++ )
{
DamperTrails[C]= new SFNode('Transform{}');
ChaserTrails[C]= new SFNode('Transform{}');
DamperTrails[C].children[0]= cShapeDamperTrailPoint;
ChaserTrails[C].children[0]= cShapeChaserTrailPoint;
}
GrDamperTrail.children= DamperTrails;
GrChaserTrail.children= ChaserTrails;
}
function DamperPos(Pos)
{
lastDamperPos= Pos;
}
function ChaserPos(Pos)
{
lastChaserPos= Pos;
}
function Tick()
{
for(var C= cNumTrailPoints - 1; C>0; C-- )
{
DamperTrails[C].translation= DamperTrails[ C - 1].translation;
ChaserTrails[C].translation= ChaserTrails[C - 1].translation;
}
DamperTrails[0].translation= lastDamperPos;
ChaserTrails[0].translation= lastChaserPos;
}
]]>
|
|
| 196 | </Script> |
| 197 | < ROUTE fromNode='TmrTrail' fromField='cycleTime' toNode='ScrTrailer' toField='Tick'/> |
| 198 | < ROUTE fromNode='TrObjectDampered' fromField='translation' toNode='ScrTrailer' toField='DamperPos'/> |
| 199 | < ROUTE fromNode='TrObjectFollowed' fromField='translation' toNode='ScrTrailer' toField='ChaserPos'/> |
| 200 | < ROUTE fromNode='ScrBtnMgr' fromField='WcDamper' toNode='SwDamperTrail' toField='whichChoice'/> |
| 201 | < ROUTE fromNode='ScrBtnMgr' fromField='WcChaser' toNode='SwChaserTrail' toField='whichChoice'/> |
| 202 | </Scene> |
| 203 | </X3D> |
Event Graph ROUTE Table entries with 14 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.
|
TouchPosition
TouchSensor |
description='move ball to demonstrate PositionChaser2D, PositionDamper2D' User-interaction hint for this node.(TouchSensor description is providing a tooltip) |
|
TmrTrail
TimeSensor cycleTime SFTime |
ScrTrailer
Script Tick SFTime |
|
ScrTrailer
Script |
No direct ROUTE connection found for events to/from this node. Contains SFNode fields with direct access to another node. Contains MFNode fields with direct access to another node. |
|
BtnChaser
ProtoInstance isOn SFBool |
ScrBtnMgr
Script BtnChaserIsOn SFBool |
then
|
ScrBtnMgr
Script WcChaser SFInt32 |
SwObjectFollowed
Switch whichChoice SFInt32 |
||
|
then
|
ScrBtnMgr
Script WcChaser SFInt32 |
SwChaserTrail
Switch whichChoice SFInt32 |
||||
|
then
|
ScrBtnMgr
Script WcDamper SFInt32 |
SwObjectDampered
Switch whichChoice SFInt32 |
||||
|
then
|
ScrBtnMgr
Script WcDamper SFInt32 |
SwDamperTrail
Switch whichChoice SFInt32 |
||||
|
BtnDamper
ProtoInstance isOn SFBool |
ScrBtnMgr
Script BtnDamperIsOn SFBool |
then
|
ScrBtnMgr
Script WcChaser SFInt32 |
SwObjectFollowed
Switch whichChoice SFInt32 |
||
|
then
|
ScrBtnMgr
Script WcChaser SFInt32 |
SwChaserTrail
Switch whichChoice SFInt32 |
||||
|
then
|
ScrBtnMgr
Script WcDamper SFInt32 |
SwObjectDampered
Switch whichChoice SFInt32 |
||||
|
then
|
ScrBtnMgr
Script WcDamper SFInt32 |
SwDamperTrail
Switch whichChoice SFInt32 |
||||
|
PlaneSensorPosition
PlaneSensor trackPoint_changed SFVec3f |
TrObjectDirect
Transform translation SFVec3f |
|||||||||
|
PlaneSensorPosition
PlaneSensor trackPoint_changed SFVec3f |
PositionDamperNode
PositionDamper set_destination SFVec3f |
then
|
PositionDamperNode
PositionDamper value_changed SFVec3f |
TrObjectDampered
Transform translation SFVec3f |
then
|
TrObjectDampered
Transform translation SFVec3f |
ScrTrailer
Script DamperPos SFVec3f |
|||
|
PlaneSensorPosition
PlaneSensor trackPoint_changed SFVec3f |
PositionChaserNode
PositionChaser set_destination SFVec3f |
then
|
PositionChaserNode
PositionChaser value_changed SFVec3f |
TrObjectFollowed
Transform translation SFVec3f |
then
|
TrObjectFollowed
Transform translation SFVec3f |
ScrTrailer
Script ChaserPos SFVec3f |
<!--
Color-coding 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)
<ProtoInstance name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->