X3D Model Documentation: WheelsRearLeftExample.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='title' content='WheelsRearLeftExample.x3d'/>
  6            <meta name='description' content='An animation example of rear left wheels and axle Prototype. Clicking the axle triggers an animation for gear to go up or gear down on rear left wheels and axle.'/>
  7            <meta name='creator' content='Etsuko Lippi'/>
  8            <meta name='created' content='18 October 2001'/>
  9            <meta name='modified' content='20 October 2019'/>
 10            <meta name='generator' content='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
 11            <meta name='identifier' content='https://savage.nps.edu/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/WheelsRearLeftExample.x3d'/>
 12            <meta name='subject' content="rear wheels' animation, gear up and down"/>
 13            <meta name='license' content='../../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: ExampleSelectionScript, GearUpDown, GearUpDownTouchSensor, WP

Index for ExternProtoDeclare definition: WheelsRearLeft
-->
 15       <Scene>
 16            <WorldInfo title='WheelsRearLeftExample.x3d'/>
 17            <ExternProtoDeclare name='WheelsRearLeft'   url=' "WheelsRearLeftPrototype.x3d#WheelsRearLeft" "https://savage.nps.edu/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/WheelsRearLeftPrototype.x3d#WheelsRearLeft" "WheelsRearLeftPrototype.wrl#WheelsRearLeft" "https://savage.nps.edu/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/WheelsRearLeftPrototype.wrl#WheelsRearLeft" '>
 18                 <field name='gearup' type='SFBool' accessType='inputOnly'/>
 19                 <field name='gearupOut' type='SFBool' accessType='outputOnly'/>
 20                 <field name='animationStartTime' type='SFTime' accessType='inputOnly'/>
 21                 <field name='traceEnabled' type='SFBool' accessType='initializeOnly'/>
 22            </ExternProtoDeclare>
 23            <Background skyColor='0.7 0.7 0.7'/>
 24            <Group>
 25                 <Transform DEF='GearUpDown'>
 26 
                    <!-- ROUTE information for ExampleSelectionScript node:  [from GearUpDownTouchSensor.isActive to enabled ] [from status to WP.gearup ] -->
                    <Script DEF='ExampleSelectionScript'>
 27                           <field name='landed' type='SFInt32' value='-1' accessType='initializeOnly'/>
 28                           <field name='enabled' type='SFBool' accessType='inputOnly'/>
 29                           <field name='status' type='SFBool' accessType='outputOnly'/>
  <![CDATA[
          
ecmascript:

function tracePrint (outputString)
{
	var traceEnabled = false;
	if (traceEnabled) Browser.println ('[trace] ' + outputString);
}

function enabled(value, timeStamp) {

	tracePrint('enabled = ' + value);
	if (value == true)
	{
		if (landed == -1)
		{			
                        status = false;
                        landed = 0;			
		}
                
		if (landed == 0)
		{
			if (status)
			{
				status = false;                               
			}
			else
			{
				status = true;                               			
			}
		}

                else
                {
         		landed = 0;
     			return;
                }
	}
	//print ('status = ' + status);
}

        
]]>
 31                      </Script>
 32                 </Transform>
 33 
               <!-- ROUTE information for GearUpDownTouchSensor node:  [from touchTime to WP.animationStartTime ] [from isActive to ExampleSelectionScript.enabled ] -->
               <TouchSensor DEF='GearUpDownTouchSensor' description='click for gears up/down'/>
 34 
               <!-- ROUTE information for WP node:  [from GearUpDownTouchSensor.touchTime to animationStartTime ] [from ExampleSelectionScript.status to gearup ] -->
               <ProtoInstance name='WheelsRearLeft' DEF='WP'>
 35                      <fieldValue name='traceEnabled' value='true'/>
 36                 </ProtoInstance>
 37            </Group>
 38            < ROUTE  fromNode='GearUpDownTouchSensor' fromField='touchTime' toNode='WP' toField='animationStartTime'/>
 39            < ROUTE  fromNode='GearUpDownTouchSensor' fromField='isActive' toNode='ExampleSelectionScript' toField='enabled'/>
 40            < ROUTE  fromNode='ExampleSelectionScript' fromField='status' toNode='WP' toField='gearup'/>
 41       </Scene>
 42  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: ExampleSelectionScript, GearUpDown, GearUpDownTouchSensor, WP

Index for ExternProtoDeclare definition: WheelsRearLeft
-->
X3D Tooltips element index: Background, ExternProtoDeclare, field, fieldValue, Group, head, meta, ProtoInstance, ROUTE, Scene, Script, TouchSensor, Transform, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table entries with 3 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.

GearUpDownTouchSensor
TouchSensor
touchTime
SFTime
→
ROUTE
event to
(1)
WP
ProtoInstance
animationStartTime
SFTime
GearUpDownTouchSensor
TouchSensor
isActive
SFBool
→
ROUTE
event to
(1)
ExampleSelectionScript
Script
enabled
SFBool
then
 
 
 
ExampleSelectionScript
Script
status
SFBool
→
ROUTE
event to
(2)
WP
ProtoInstance
gearup
SFBool

      WP
ProtoInstance
WheelsRearLeft
No ROUTE connection found for output events 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. 

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://savage.nps.edu/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/WheelsRearLeftExampleIndex.html -->
<!-- Version control at
https://gitlab.nps.edu/Savage/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/WheelsRearLeftExample.x3d -->

<!-- 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> -->

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