X3D Model Documentation: ArbitraryAxisCylinderSensorExamples.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  4       <head>
  5            <meta name='titlecontent=' ArbitraryAxisCylinderSensorExamples.x3d '/>
  6            <meta name='descriptioncontent="Modified CylinderSensor oriented about an arbitrary axis, relative to peer/child geometry that remains oriented to its original axis. Select and drag each object to rotate. Originally authored by Don Brutzman's MV4204 class, with modifications by Maj James Breitinger USMC to include min/max angles of rotation and object center. Motivation: Modify example shown by Chapter 9 Figure 7 to build a PROTO for a CylinderSensor oriented about an arbitrary axis."/>
  7            <meta name=' warning content=' ArbitraryAxisCylinderSensor operates on its children, NOT on its peers. This variation is necessary in order to accomplish the desired Transform rotation to a new orientation axis. '/>
  8            <meta name='creatorcontent='Don Brutzman'/>
  9            <meta name='createdcontent='1 October 1998'/>
 10            <meta name='modifiedcontent='11 August 2025'/>
 11            <meta name='Imagecontent='ArbitraryAxisCylinderSensorExamples.png'/>
 12            <meta name='Imagecontent='ArbitraryAxisCylinderSensorExamples.rotated.png'/>
 13            <meta name='referencecontent=' ArbitraryAxisCylinderSensorPrototype.x3d '/>
 14            <meta name='referencecontent='ArbitraryAxisCylinderSensorExampleOriginal.wrl'/>
 15            <meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ArbitraryAxisCylinderSensorExamples.x3d '/>
 16            <meta name='referencecontent='The VRML 2.0 Sourcebook'/>
 17            <meta name='generatorcontent='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/>
 18            <meta name='licensecontent='../../license.html'/>
 19       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: Example1-Cylinder, Example2-Box, Example3-Cone, Example4-Cone, Example5-Text, MiddleTransformY, SensorMiddleTransformY

Index for Viewpoint node: Viewpoint_1

Index for ExternProtoDeclare definition: ArbitraryAxisCylinderSensor
-->
 20       <Scene>
 21            <WorldInfo title='ArbitraryAxisCylinderSensorExamples.x3d'/>
 22            <ExternProtoDeclare name='ArbitraryAxisCylinderSensorappinfo='Modified CylinderSensor with children nodes oriented about an arbitrary axis. Warning: ArbitraryAxisCylinderSensor affects children, not peers.'   url=' "../../../Savage/Tools/Animation/ArbitraryAxisCylinderSensorPrototype.x3d#ArbitraryAxisCylinderSensor" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ArbitraryAxisCylinderSensorPrototype.x3d#ArbitraryAxisCylinderSensor" "../../../Savage/Tools/Animation/ArbitraryAxisCylinderSensorPrototype.wrl#ArbitraryAxisCylinderSensor" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ArbitraryAxisCylinderSensorPrototype.wrl#ArbitraryAxisCylinderSensor" '>
 23                 <field name='shiftRotationAxistype='SFRotationaccessType='initializeOnly'
                appinfo='shifted axis of rotation from local vertical, default 1 0 0 0'/>
 24                 <field name='centertype='SFVec3faccessType='initializeOnly'
                appinfo='local center for axis of rotation, default 0 0 0'/>
 25                 <field name='showCylinderSensorShapetype='SFBoolaccessType='initializeOnly'
                appinfo='whether to show visualization shape to show orientation and cylindrical mapping of mouse movements by sensor, default true'/>
 26                 <field name='scaleCylinderSensorShapetype='SFVec3faccessType='inputOutput'
                appinfo='scale for visualization shape, default 1 1 1'/>
 27                 <field name='colorCylinderSensorShapetype='SFColoraccessType='inputOutput'
                appinfo='color for visualization shape, default 0.9 0.9 0.4'/>
 28                 <field name='transparencyCylinderSensorShapetype='SFFloataccessType='inputOutput'
                appinfo='transparency for visualization shape'/>
 29                 <field name='childrentype='MFNodeaccessType='inputOutput'
                appinfo='children nodes affected by ArbitraryAxisCylinderSensor'/>
 30                 <field name='autoOffsettype='SFBoolaccessType='inputOutput'
                appinfo='determines whether previous offset values are remembered/accumulated, default true'/>
 31                 <field name='descriptiontype='SFStringaccessType='inputOutput'
                appinfo='Text tooltip displayed for user interaction'/>
 32                 <field name='diskAngletype='SFFloataccessType='inputOutput'
                appinfo='diskAngle 0 forces disk-like behavior, diskAngle 1.57 (90 degrees) forces cylinder-like behavior, default 0.262, range [0,pi/2]'/>
 33                 <field name='enabledtype='SFBoolaccessType='inputOutput'
                appinfo='enables/disables node operation, default true'/>
 34                 <field name='minAngletype='SFFloataccessType='inputOutput'
                appinfo='clamps rotation_changed events, default 0, range [-2pi,2pi]'/>
 35                 <field name='maxAngletype='SFFloataccessType='inputOutput'
                appinfo='clamps rotation_changed events, default -1, range [-2pi,2pi]'/>
 36                 <field name='offsettype='SFFloataccessType='initializeOnly'
                appinfo='sends event and remembers last value sensed, default 0, range (-infinity,infinity)'/>
 37                 <field name='isActivetype='SFBoolaccessType='outputOnly'
                appinfo='output event isActive=true when primary mouse button is pressed, output event isActive=false when released.'/>
 38                 <field name='rotation_changedtype='SFRotationaccessType='outputOnly'
                appinfo='rotation_changed events equal sum of relative bearing changes plus offset value about Y-axis in local coordinate system'/>
 39                 <field name='trackPoint_changedtype='SFVec3faccessType='outputOnly'
                appinfo="trackPoint_changed events give intersection point of bearing with sensor's virtual geometry"/>
 40            </ExternProtoDeclare>
 41            <Viewpoint description='ArbitraryAxisCylinderSensor Examples'/>
 42            <Group>
 43                 <!-- Leftmost shape is red with ArbitraryAxisCylinderSensor oriented around X-axis -->
 44                 <Transform DEF='Example1-Cylindertranslation='-3 2 0'>
 45                      <ProtoInstance name='ArbitraryAxisCylinderSensor'>
 46                           <!-- rotate yAxis to xAxis -->
 47                           <fieldValue name='shiftRotationAxisvalue='0 0 1 -1.5707963'/>
 48                           <fieldValue name='children'>
 49                                <Shape>
 50                                     <Cylinder/>
 51                                     <Appearance>
 52                                          <Material diffuseColor='1 0 0'/>
 53                                     </Appearance>
 54                                </Shape>
 55                           </fieldValue>
 56                      </ProtoInstance>
 57                 </Transform>
 58                 <!-- Middle shape is green with ordinary CylinderSensor oriented around Y-axis -->
 59                 <Group DEF='Example2-Box'>
 60 
                    <!-- ROUTE information for MiddleTransformY node:  [from SensorMiddleTransformY.rotation_changed to rotation ] -->
                    <Transform DEF='MiddleTransformYtranslation='0 2 0'>
 61                           <Shape>
 62                                <Box/>
 63                                <Appearance>
 64                                     <Material diffuseColor='0 1 0'/>
 65                                </Appearance>
 66                           </Shape>
 67 
                         <!-- ROUTE information for SensorMiddleTransformY node:  [from rotation_changed to MiddleTransformY.rotation ] -->
                         <CylinderSensor DEF='SensorMiddleTransformYdescription='Select and drag regular CylinderSensor to rotate'/>
 68                           < ROUTE  fromNode='SensorMiddleTransformY' fromField='rotation_changed' toNode='MiddleTransformY' toField='rotation'/>
 69                      </Transform>
 70                 </Group>
 71                 <!-- Rightmost shape blue with ArbitraryAxisCylinderSensor oriented around Z-axis -->
 72                 <Transform DEF='Example3-Conetranslation='3 2 0'>
 73                      <ProtoInstance name='ArbitraryAxisCylinderSensor'>
 74                           <!-- rotate yAxis to zAxis -->
 75                           <fieldValue name='shiftRotationAxisvalue='1 0 0 1.5707963'/>
 76                           <fieldValue name='children'>
 77                                <Shape>
 78                                     <Cone/>
 79                                     <Appearance>
 80                                          <Material diffuseColor='0 0 1'/>
 81                                     </Appearance>
 82                                </Shape>
 83                           </fieldValue>
 84                      </ProtoInstance>
 85                 </Transform>
 86                 <!-- bottom white shape shows use of ArbitraryAxisCylinderSensor center field -->
 87                 <Transform DEF='Example4-Conetranslation='-3.5 -1 0'>
 88                      <ProtoInstance name='ArbitraryAxisCylinderSensor'>
 89                           <!-- rotate yAxis to zAxis -->
 90                           <!-- rotate yAxis halfway to xAxis -->
 91                           <fieldValue name='shiftRotationAxisvalue='0 0 1 -0.785'/>
 92                           <fieldValue name='centervalue='0 -2 0'/>
 93                           <fieldValue name='showCylinderSensorShapevalue='true'/>
 94                           <fieldValue name='scaleCylinderSensorShapevalue='1 2 1'/>
 95                           <fieldValue name='colorCylinderSensorShapevalue='0.4 0.9 0.9'/>
 96                           <fieldValue name='transparencyCylinderSensorShapevalue='0.4'/>
 97                           <fieldValue name='descriptionvalue='Select and drag to rotate'/>
 98                           <fieldValue name='children'>
 99                                <Shape>
100                                     <Cone/>
101                                     <Appearance>
102                                          <Material diffuseColor='1 1 1'/>
103                                     </Appearance>
104                                </Shape>
105                           </fieldValue>
106                      </ProtoInstance>
107                 </Transform>
108                 <!-- Finally some explanation text. Try setting showIcon to true. -->
109                 <Transform DEF='Example5-Texttranslation='1.8 -1.5 0'>
110                      <ProtoInstance name='ArbitraryAxisCylinderSensor'>
111                           <!-- rotate yAxis to zAxis -->
112                           <!-- rotate yAxis halfway to -xAxis -->
113                           <fieldValue name='shiftRotationAxisvalue='0 0 1 0.785'/>
114                           <fieldValue name='centervalue='0 0 0'/>
115                           <fieldValue name='showCylinderSensorShapevalue='false'/>
116                           <fieldValue name='scaleCylinderSensorShapevalue='0.05 2 0.05'/>
117                           <fieldValue name='colorCylinderSensorShapevalue='1 1 1'/>
118                           <fieldValue name='transparencyCylinderSensorShapevalue='0.9'/>
119                           <fieldValue name='children'>
120                                <Shape>
121                                     <Appearance>
122                                          <Material diffuseColor='0 1 1emissiveColor='0 1 1'/>
123                                     </Appearance>
124                                     <Text string='"ArbitraryAxisCylinderSensor" "Examples"'>
125                                          <FontStyle justify='"MIDDLE" "MIDDLE"size='0.6'/>
126                                     </Text>
127                                </Shape>
128                                <Shape>
129                                     <Box size='6.4 1.4 0.05'/>
130                                     <Appearance>
131                                          <Material transparency='1'/>
132                                     </Appearance>
133                                </Shape>
134                           </fieldValue>
135                      </ProtoInstance>
136                 </Transform>
137            </Group>
138       </Scene>
139  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: Example1-Cylinder, Example2-Box, Example3-Cone, Example4-Cone, Example5-Text, MiddleTransformY, SensorMiddleTransformY

Index for Viewpoint node: Viewpoint_1

Index for ExternProtoDeclare definition: ArbitraryAxisCylinderSensor
-->
X3D Tooltips element index: Appearance, Box, Cone, Cylinder, CylinderSensor, ExternProtoDeclare, field, fieldValue, FontStyle, Group, head, Material, meta, ProtoInstance, ROUTE, Scene, Shape, Text, Transform, Viewpoint, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table with 1 ROUTE connection 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.

line 45
ProtoInstance
ArbitraryAxisCylinderSensor
No direct ROUTE connection found for events to/from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declaration with
direct access to other nodes, and thus has potential to produce run-time animation. 

line 73
ProtoInstance
ArbitraryAxisCylinderSensor
No direct ROUTE connection found for events to/from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declaration with
direct access to other nodes, and thus has potential to produce run-time animation. 

line 88
ProtoInstance
ArbitraryAxisCylinderSensor
No direct ROUTE connection found for events to/from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declaration with
direct access to other nodes, and thus has potential to produce run-time animation. 

line 110
ProtoInstance
ArbitraryAxisCylinderSensor
No direct ROUTE connection found for events to/from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declarations with
direct access to other nodes, and thus has potential to produce run-time animation. 

SensorMiddleTransformY
CylinderSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
MiddleTransformY
Transform
rotation
SFRotation

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ArbitraryAxisCylinderSensorExamplesIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ArbitraryAxisCylinderSensorExamples.x3d -->

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idNamefield='value'/> matches XML terminology <XmlElement  DEF='idNameattribute='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> -->

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