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=' WaypointInterpolatorExample.x3d '/> |
6 | <meta name='description' content='Example set of waypoints, plus either leg durations or speed(s), which demonstrates resulting position/orientation interpolation. Motion can be stopped/started by placing mouse over orange TouchSensor Box. A HiddenViewpoint also exists under the coordinate axes. Trace values are printed in the browser console.'/> |
7 | <meta name='creator' content='Don Brutzman, Curtis Blais, Jeff Weekley, Jane Wu'/> |
8 | <meta name='created' content='6 April 2001'/> |
9 | <meta name='modified' content='23 August 2023'/> |
10 |
<meta name='Image' content='WaypointInterpolatorExample.png'![]() |
11 | <meta name=' warning ' content=' Cortona bug: TimeSensor set_cycleInterval has no effect, effectively ignoring routed totalDuration. Workaround: view calculated value for totalDuration, then set it in TimeSensor manually. '/> |
12 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolatorExample.x3d '/> |
13 | <meta name='reference' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d '/> |
14 | <meta name='generator' content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
15 | <meta name='license' content='../../license.html'/> |
16 | </head> |
17 | <Scene> |
18 | <!-- ====================================== --> |
19 | <!-- To use WaypointInterpolator in your scene, copy/paste this definition verbatim first. --> |
20 | <WorldInfo title='WaypointInterpolatorExample.x3d'/> |
21 | <ExternProtoDeclare name='WaypointInterpolator' appinfo='Reads waypoints and legSpeeds/legDurations/defaultSpeed to provide a customizable position/orientation interpolator.' url=' "../../../Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator" "../../../Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator" '> |
22 | <!-- Priority of use: legSpeeds (m/sec), legDurations (seconds), defaultSpeed (m/sec) --> |
23 |
<field name='description' type='SFString' accessType='initializeOnly'
appinfo='Short description of what is animated by this WaypointInterpolator.'/> |
24 |
<field name='waypoints' type='MFVec3f' accessType='initializeOnly'
appinfo='Waypoints being traversed with interpolation of intermediate positions and orientations.'/> |
25 |
<field name='add_waypoint' type='SFVec3f' accessType='inputOnly'
appinfo='Add another single waypoint to array of waypoints recalculate interpolator values.'/> |
26 |
<field name='set_waypoints' type='MFVec3f' accessType='inputOnly'
appinfo='Replace all waypoints recalculate interpolator values.'/> |
27 |
<field name='pitchUpDownForVerticalWaypoints' type='SFBool' accessType='initializeOnly'
appinfo='Whether to pitch child geometry (such as a vehicle) up or down to match vertical slope'/> |
28 |
<field name='legSpeeds' type='MFFloat' accessType='initializeOnly'
appinfo='Units m/sec. If used, array lengths for legSpeeds and legDurations must be one less than number of waypoints.'/> |
29 |
<field name='legDurations' type='MFTime' accessType='initializeOnly'
appinfo='Units in seconds. If used, array lengths for legSpeeds and legDurations must be one less than number of waypoints.'/> |
30 |
<field name='defaultSpeed' type='SFFloat' accessType='initializeOnly'
appinfo='Units m/sec.'/> |
31 |
<field name='turningRate' type='SFFloat' accessType='initializeOnly'
appinfo='turningRate (degrees/second) also determines standoff distance prior to waypoint where turn commences. If 0 turns are instantaneous.'/> |
32 |
<field name='totalDuration' type='SFTime' accessType='outputOnly'
appinfo='Output calculation summing all leg durations, useful for setting TimeSensor cycleInterval. Units in seconds.'/> |
33 | <!-- interpolation fields --> |
34 |
<field name='set_fraction' type='SFFloat' accessType='inputOnly'
appinfo='exposed PositionInterpolator and OrientationInterpolator setting'/> |
35 |
<field name='position_changed' type='SFVec3f' accessType='outputOnly'
appinfo='exposed PositionInterpolator setting'/> |
36 |
<field name='orientation_changed' type='SFRotation' accessType='outputOnly'
appinfo='exposed OrientationInterpolator setting'/> |
37 | <!-- display-related fields --> |
38 |
<field name='lineColor' type='SFColor' accessType='inputOutput'
appinfo='default color for non-active line segments'/> |
39 |
<field name='highlightSegmentColor' type='SFColor' accessType='inputOutput'
appinfo='active segment highlight color'/> |
40 |
<field name='transparency' type='SFFloat' accessType='inputOutput'
appinfo='1.0 is completely transparent, 0.0 is completely opaque.'/> |
41 |
<field name='labelDisplayMode' type='SFString' accessType='initializeOnly'
appinfo='allowed values: none; waypoints (produce labels at each waypoint); or interpolation (produce single moving label at interpolator time course speed location)'/> |
42 |
<field name='heightLabel' type='SFString' accessType='initializeOnly'
appinfo='allowed values: altitude depth (negate Y value) none'/> |
43 |
<field name='labelOffset' type='SFVec3f' accessType='initializeOnly'
appinfo='heightLabel relative location'/> |
44 |
<field name='labelFontSize' type='SFFloat' accessType='initializeOnly'
appinfo='heightLabel text size'/> |
45 |
<field name='labelColor' type='SFColor' accessType='initializeOnly'
appinfo='heightLabel text color'/> |
46 |
<field name='traceEnabled' type='SFBool' accessType='initializeOnly'
appinfo='enable console output to trace script computations and prototype progress'/> |
47 |
<field name='outputInitializationComputations' type='SFBool' accessType='initializeOnly'
appinfo='Output the number of waypoints totalDistance and totalDuration to console upon initialization'/> |
48 |
<field name='verticalDropLineColor' type='SFColor' accessType='inputOutput'
appinfo='default color for vertical drop-line segments'/> |
49 |
<field name='verticalDropLineTransparency' type='SFFloat' accessType='inputOutput'
appinfo='1.0 is completely transparent, 0.0 is completely opaque.'/> |
50 | </ExternProtoDeclare> |
51 | <!-- ====================================== --> |
52 | <!-- Here is another interesting prototype authoring tool. --> |
53 | <ExternProtoDeclare name='HiddenViewpoint' appinfo='Hidden viewpoint becomes active (binds) upon pointer selection to reveal an interesting view with an optionally label' url=' "../../../Savage/Tools/Animation/HiddenViewpointPrototype.x3d#HiddenViewpoint" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/HiddenViewpointPrototype.x3d#HiddenViewpoint" "../../../Savage/Tools/Animation/HiddenViewpointPrototype.wrl#HiddenViewpoint" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/HiddenViewpointPrototype.wrl#HiddenViewpoint" '> |
54 | <field name='position' type='SFVec3f' accessType='inputOutput'/> |
55 | <field name='rotation' type='SFRotation' accessType='inputOutput'/> |
56 | <field name='sensorRadius' type='SFFloat' accessType='initializeOnly'/> |
57 | <field name='activate' type='SFBool' accessType='inputOnly'/> |
58 | <field name='label' type='MFString' accessType='inputOutput'/> |
59 | <field name='labelOffset' type='SFVec3f' accessType='inputOutput'/> |
60 | <field name='labelFontSize' type='SFFloat' accessType='initializeOnly'/> |
61 | <field name='labelColor' type='SFColor' accessType='inputOutput'/> |
62 | </ExternProtoDeclare> |
63 | <!-- ====================================== --> |
64 | <!-- Example instance follows prototype declaration --> |
65 | <Viewpoint description='WaypointInterpolator example' orientation='1 0 0 -0.3' position='-1 5 13'/> |
66 | <Viewpoint description='Above, looking down' orientation='1 0 0 -1.57' position='0 15 -5'/> |
67 | <Inline DEF='CoordinateAxes' url=' "../../../Savage/Tools/Authoring/CoordinateAxes.x3d" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/CoordinateAxes.x3d" "../../../Savage/Tools/Authoring/CoordinateAxes.wrl" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/CoordinateAxes.wrl" '/> |
68 | <!-- 10 second default cycleInterval should get overridden by 25.3 second computed totalDuration. --> |
69 |
<!-- ROUTE information for Clock node:
[from TrackBuilder.totalDuration to set_cycleInterval
]
[from TouchBox.isOver to enabled
]
[from fraction_changed to TrackBuilder.set_fraction
]
-->
<TimeSensor DEF='Clock' cycleInterval='10.0' loop='true'/> |
70 |
<!-- ROUTE information for TrackBuilder node:
[from Clock.fraction_changed to set_fraction
]
[from totalDuration to Clock.set_cycleInterval
]
[from position_changed to TrackingTransform.translation
]
[from orientation_changed to TrackingTransform.rotation
]
-->
<ProtoInstance name='WaypointInterpolator' DEF='TrackBuilder'> |
71 | <fieldValue name='description' value='TrackBuilder'/> |
72 | <!-- Priority of use: legSpeeds (m/sec), legDurations (seconds), defaultSpeed (m/sec) --> |
73 | <fieldValue name='waypoints' value='-5 0 0 5 2 0 5 5 -10 4.9 2 -10 -5 0 -10 -5 0 0 -5.5 0 1.5 -7 0.5 2 -8 0 0 -5 0 0'/> |
74 | <fieldValue name='pitchUpDownForVerticalWaypoints' value='false'/> |
75 | <fieldValue name='legDurations' value='1 2 3 1 2 3 1 2 3'/> |
76 | <fieldValue name='legSpeeds' value='2 4 2 2 4 1 1 1 1'/> |
77 | <fieldValue name='defaultSpeed' value='5'/> |
78 | <fieldValue name='turningRate' value='90'/> |
79 | <fieldValue name='lineColor' value='1 0 0'/> |
80 | <fieldValue name='highlightSegmentColor' value='0.2 0.2 1'/> |
81 | <fieldValue name='transparency' value='0'/> |
82 | <fieldValue name='labelDisplayMode' value='interpolation'/> |
83 | <fieldValue name='heightLabel' value='altitude'/> |
84 | <fieldValue name='labelOffset' value='0 1.2 0'/> |
85 | <fieldValue name='labelFontSize' value='0.5'/> |
86 | <fieldValue name='labelColor' value='0.3 0.9 0.3'/> |
87 | <fieldValue name='traceEnabled' value='false'/> |
88 | <fieldValue name='outputInitializationComputations' value='true'/> |
89 | </ProtoInstance> |
90 | < ROUTE fromNode='Clock' fromField='fraction_changed' toNode='TrackBuilder' toField='set_fraction'/> |
91 | < ROUTE fromNode='TrackBuilder' fromField='totalDuration' toNode='Clock' toField='set_cycleInterval'/> |
92 |
<!-- ROUTE information for TrackingTransform node:
[from TrackBuilder.position_changed to translation
]
[from TrackBuilder.orientation_changed to rotation
]
-->
<Transform DEF='TrackingTransform'> |
93 | <!-- Always align initial geometry with X axis --> |
94 | <Group> |
95 | <!-- Point cone along X-axis --> |
96 | <Transform rotation='0 0 1 -1.57'> |
97 | <Shape> |
98 | <Cone bottomRadius='0.4'/> |
99 |
<!-- Appearance
ConeAppearance is a DEF node that has 1 USE node: USE_1 -->
<Appearance DEF='ConeAppearance'> |
100 | <Material diffuseColor='0.8 0.8 0.2'/> |
101 | </Appearance> |
102 | </Shape> |
103 | </Transform> |
104 | <Transform translation='0 0.1 0'> |
105 | <Shape> |
106 | <Cone bottomRadius='0.1' height='0.8'/> |
107 | <Appearance USE='ConeAppearance'/> |
108 | </Shape> |
109 | </Transform> |
110 | <Viewpoint description='Ride on' orientation='0 1 0 -1.57' position='-4 1 0'/> |
111 | <Viewpoint description='Ride alongside' position='0 0 5'/> |
112 | <Viewpoint description='Ride in front' orientation='0 1 0 1.57' position='4 1 0'/> |
113 | </Group> |
114 | </Transform> |
115 | < ROUTE fromNode='TrackBuilder' fromField='position_changed' toNode='TrackingTransform' toField='translation'/> |
116 | < ROUTE fromNode='TrackBuilder' fromField='orientation_changed' toNode='TrackingTransform' toField='rotation'/> |
117 | <!-- floor employs TouchSensor.isOver to stop/start animation --> |
118 | <Group DEF='FloorAndToggleMarker'> |
119 | <Transform translation='0 -0.1 -5'> |
120 | <Shape> |
121 | <Box size='10 0.1 10'/> |
122 | <Appearance DEF='FloorAppearance'> |
123 | <Material diffuseColor='0.1 0.8 0.9'/> |
124 | </Appearance> |
125 | </Shape> |
126 | </Transform> |
127 | <!-- starting point marker toggles playback --> |
128 | <Transform translation='-5 0 0'> |
129 |
<!-- ROUTE information for TouchBox node:
[from isOver to Clock.enabled
]
-->
<TouchSensor DEF='TouchBox' description='Touch box to toggle playback'/> |
130 | < ROUTE fromNode='TouchBox' fromField='isOver' toNode='Clock' toField='enabled'/> |
131 | <Shape> |
132 | <Box DEF='TogglePlayback' size='0.1 0.8 0.1'/> |
133 |
<!-- Appearance
OrangeAppearance is a DEF node that has 1 USE node: USE_1 -->
<Appearance DEF='OrangeAppearance'> |
134 | <Material diffuseColor='0.8 0.5 0.2'/> |
135 | </Appearance> |
136 | </Shape> |
137 | <Transform translation='0 1.4 0'> |
138 | <Billboard> |
139 | <Shape> |
140 | <Text string=' "isOver" "toggles" "motion" "off/on" '> |
141 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.3'/> |
142 | </Text> |
143 | <Appearance USE='OrangeAppearance'/> |
144 | </Shape> |
145 | </Billboard> |
146 | </Transform> |
147 | <!-- Illuminate bottom of floor for HiddenViewpoint clarity --> |
148 | <PointLight location='0 -6 0' radius='10'/> |
149 | </Transform> |
150 | </Group> |
151 | <!-- Example instance of clickable viewpoint prototype --> |
152 | <ProtoInstance name='HiddenViewpoint' DEF='TestHiddenViewpointPrototype'> |
153 | <fieldValue name='position' value='0 -0.5 0'/> |
154 | <fieldValue name='rotation' value='0 1 0 2.5'/> |
155 | <fieldValue name='sensorRadius' value='1'/> |
156 | <fieldValue name='label' value='"HiddenViewpoint" "test works!"'/> |
157 | <fieldValue name='labelOffset' value='1 -1.25 0'/> |
158 | <fieldValue name='labelFontSize' value='0.4'/> |
159 | <fieldValue name='labelColor' value='1 0 0'/> |
160 | </ProtoInstance> |
161 | </Scene> |
162 | </X3D> |
Event Graph ROUTE Table entries with 5 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.
TestHiddenViewpointPrototype
ProtoInstance HiddenViewpoint |
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. |
<!--
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.
-->