<head>
</head>
<!--
Index for ProtoDeclare definition
:
FourBladeMainRotor
Index for DEF nodes
:
Arm,
Blade,
BladeColor,
BladeRotationOnOffScript,
Clock,
ExampleBladeRotationToggle,
ExampleMainRotor,
ExampleSelection,
FourBlades,
MainRotor,
MainRotorPath,
RotationSwitch,
ShaftColor,
ToggleStatusColor,
Tube
Index for Viewpoint images
:
Viewpoint_1,
Viewpoint_2
-->
<Scene>
<ProtoDeclare name='FourBladeMainRotor'>
<ProtoInterface>
<field name='rotationOn' type='SFBool' accessType='inputOnly'
appinfo='enable or disable rotor rotation'/>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for MainRotor node:
[from MainRotorPath.value_changed to set_rotation
]
-->
<Transform DEF='MainRotor'>
<!-- Rotor Shaft -->
<Transform scale='0.6 0.6 0.6'>
<Shape>
<Appearance DEF='ShaftColor'>
<Material diffuseColor='0.5 0.5 0.5'/>
</Appearance>
<Cylinder bottom='false' height='1.5' radius='0.1' top='false'/>
</Shape>
<Transform translation='0 0.75 0'>
<Shape>
<Appearance USE='ShaftColor'/>
<Cylinder height='0.1' radius='0.4'/>
</Shape>
</Transform>
<Transform rotation='1 0 0 1.57' translation='0 0.75 0'>
<Shape DEF='Arm'>
<Appearance USE='ShaftColor'/>
<Cylinder height='1.75' radius='0.05'/>
</Shape>
</Transform>
<Transform rotation='0 0 1 1.57' translation='0 0.75 0'>
</Transform>
<Transform translation='0 -0.4 0'>
<Shape>
<Appearance USE='ShaftColor'/>
<Cylinder height='0.1' radius='0.3'/>
</Shape>
</Transform>
<Transform rotation='0.71 0.02 -0.71 0.10' translation='0.23 0.15 0.23'>
<Shape DEF='Tube'>
<Appearance USE='ShaftColor'/>
<Cylinder height='1.1' radius='0.05'/>
</Shape>
</Transform>
<Transform rotation='-0.71 0.02 0.71 0.10' translation='-0.23 0.15 -0.23'>
</Transform>
<Transform rotation='0.71 -0.02 0.71 0.10' translation='-0.23 0.15 0.23'>
</Transform>
<Transform rotation='-0.71 -0.02 -0.71 0.10' translation='0.23 0.15 -0.23'>
</Transform>
</Transform>
<!-- ROUTE information for RotationSwitch node:
[from BladeRotationOnOffScript.switchChoice to whichChoice
]
-->
<Switch DEF='RotationSwitch' whichChoice='0'>
<Group DEF='FourBlades'>
<!-- Blade in x direction -->
<!-- Rotate 90 + 15 degree along x -->
<Transform rotation='1 0 0 1.83' translation='0.45 0.375 0.25'>
<Shape DEF='Blade'>
</Shape>
</Transform>
<!-- Blade in -z direction -->
<!-- Rotate 180 - 15 degree along z -->
<Transform rotation='0 0 1 2.88' translation='0.25 0.375 -0.45'>
</Transform>
<!-- Blade in -x direction -->
<!-- Rotate 90 - 15 on x -->
<Transform rotation='1 0 0 1.31' translation='-0.45 0.375 -0.25'>
</Transform>
<!-- Blade in z direction -->
<!-- Rotate 15 degreen on z -->
<Transform rotation='0 0 1 0.26' translation='-0.25 0.375 0.45'>
</Transform>
</Group>
<LOD range='50 200'>
<Group USE='FourBlades'/>
<Group>
<Transform translation='0 0.45 0'>
<Shape>
<Appearance>
<Material diffuseColor='0.2 0.2 0.2' transparency='0.75'/>
</Appearance>
<Cylinder height='0.1' radius='6'/>
</Shape>
</Transform>
</Group>
<WorldInfo title='null'/>
</LOD>
</Switch>
<!-- ROUTE information for BladeRotationOnOffScript node:
[from clockEnabled to Clock.set_enabled
]
[from switchChoice to RotationSwitch.whichChoice
]
-->
<Script DEF='BladeRotationOnOffScript'>
<field name='rotationOn' type='SFBool' accessType='inputOnly'/>
<field name='clockEnabled' type='SFBool' accessType='outputOnly'/>
<field name='switchChoice' type='SFInt32' accessType='outputOnly'/>
<IS>
<connect nodeField='rotationOn' protoField='rotationOn'/>
</IS>
<![CDATA[
ecmascript:
function rotationOn(value, timeStamp) {
if (value == true)
{
clockEnabled = true;
switchChoice = 1;
}
else
{
clockEnabled = false;
switchChoice = 0;
}
}
]]>
<![CDATA[
ecmascript:
function toggleEnabled(value, ts) {
if (armed == -1)
{
toggleEnabled = false;
armed = 0;
}
if (armed == 0)
{
armed = 1;
if (toggleEnabled == false)
{
status = true;
statusColor = new SFColor(0, 0.8, 0);
toggleEnabled = true;
}
else
{
status = false;
statusColor = new SFColor(0.8, 0.8, 0);
toggleEnabled = false;
}
}
else
{
armed = 0;
return;
}
}
]]>
</Scene>