#X3D V3.0 utf8 PROFILE Immersive # [X3D] version=3.0 # [X3D] noNamespaceSchemaLocation=https://www.web3d.org/specifications/x3d-3.0.xsd # X3D-to-ClassicVRML XSL translation autogenerated by X3dToClassicVrmlEncoding.xslt and X3dToVrml97.xslt # https://www.web3d.org/x3d/content/X3dToClassicVrmlEncoding.xslt # https://www.web3d.org/x3d/content/X3dToVrml97.xslt # Transformation using XSLT processor: Saxonica # head META "title" "SeaZenith.x3d" META "description" "A lightweight prototype of SeaZenith point defence gun" META "creator" "Ozan APAYDIN" META "created" "20 August 2001" META "modified" "20 October 2019" META "reference" "http://www.futura-dtp.dk/Artilleri/25mmSeaZenith.htm" META "identifier" "https://savage.nps.edu/Savage/ShipsMilitary/FrigateYavuzTurkey/SeaZenith.x3d" META "generator" "X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit" META "license" "../../license.html" # [Scene] ========== ========== ========== # Script Node to update the rotation of the gun. WorldInfo { title "SeaZenith.x3d" } DEF RotUpdater Script { # Variables and methods of the RotUpdater script inputOnly SFBool set_LRotation inputOnly SFBool set_RRotation inputOnly SFRotation get_CurRotation initializeOnly SFBool isLeft TRUE initializeOnly SFBool isRight FALSE initializeOnly SFRotation CurRot 0 1 0 0 outputOnly SFRotation newRotation # Variables and methods of the RotUpdater script url [ "ecmascript: function initialize() { CurRot[0] = 0.0; CurRot[1] = 1.0; CurRot[2] = 0.0; CurRot[3] = 0.0; } function set_LRotation(bool,time) { isLeft = bool; isRight = !bool; if(isLeft) { generate_Rotation(); } } function set_RRotation(bool,time) { isRight = bool; isLeft = !bool; if(isRight) { generate_Rotation(); } } function get_CurRotation(cR,time) { CurRot = cR; } function generate_Rotation() { newRotation = CurRot; if(isLeft) { if(CurRot[3] < 1.7) { newRotation[3] = CurRot[3] + 0.2; } } else if(isRight) { if(CurRot[3] > -1.7) { newRotation[3] = CurRot[3] - 0.2; } } } " ] } # Script node to update elevation of the gun. DEF ElevDescUpdater Script { # Variables and methods of the ElevDescUpdater script script inputOnly SFBool set_Elevation inputOnly SFBool set_Descendance inputOnly SFRotation get_CurOrientation initializeOnly SFBool isUp TRUE initializeOnly SFBool isDown FALSE initializeOnly SFRotation CurOr 0 1 0 0 outputOnly SFRotation newOrientation # Variables and methods of the ElevDescUpdater script script url [ "ecmascript: function initialize() { CurOr[0] = 0.0; CurOr[1] = 1.0; CurOr[2] = 0.0; CurOr[3] = 0.0; } function set_Elevation(bool,time) { isUp = bool; isDown = !bool; if(isUp) { generate_Rotation(); } } function set_Descendance(bool,time) { isDown = bool; isUp = !bool; if(isDown) { generate_Rotation(); } } function get_CurOrientation(cR,time) { CurOr = cR; } function generate_Rotation() { newOrientation = CurOr; if(isUp) { if(CurOr[3] < 0.45) { newOrientation[3] = CurOr[3] + 0.05; } } else if(isDown) { if(CurOr[3] > 0.05) { newOrientation[3] = CurOr[3] - 0.05; } } } " ] } # Gun Controller - Heads up displays and touch sensors Background { skyColor [ 0.1 0.1 0.6 ] } # Fire sound effect. Sound { maxBack 35 maxFront 35 source DEF FireSound AudioClip { description "machine gun sound" url [ "machngun.wav" "https://savage.nps.edu/Savage/ShipsMilitary/FrigateYavuzTurkey/machngun.wav" ] } } # Modeling the gun Transform { rotation 0 1 0 3.14 scale 1.2 1.2 1.2 translation 0.0 -1.5 0.0 children [ DEF GunBase Group { children [ Shape { geometry Cylinder { height 1.0 } appearance DEF GunAp Appearance { material Material { diffuseColor .7 .7 .8 shininess .4 } } } Transform { translation 0.0 0.4 0.0 children [ DEF Disk Shape { geometry Cylinder { height 0.1 radius 1.05 } appearance USE GunAp } ] } ] } # Mobile part of the gun (DEFLECTION) DEF TopDondur Transform { children [ DEF GunMount Group { children [ Transform { rotation 0.0 0.0 1.0 0.3 scale 1.1 1.0 1.5 translation -0.385 1.8 0.0 children [ DEF MountBody Shape { geometry Cylinder { radius 0.9 } appearance USE GunAp } Transform { scale 1.0 0.8 1.0 translation 0.0 1.0 0.0 children [ DEF MountCap Shape { geometry Sphere { radius 0.9 } appearance USE GunAp } ] } Transform { translation 0.65 0.0 0.0 children [ Shape { geometry Box { size 0.5 1.8 0.7 } appearance USE GunAp } Transform { translation 0.25 0.0 0.0 children [ Shape { geometry Box { size 0.1 1.8 0.5 } appearance Appearance { material Material { diffuseColor 0.1 0.1 0.1 } } } ] } ] } ] } Transform { rotation 1.0 0.0 0.0 1.57 children [ DEF NamluSensor CylinderSensor { description "click and drag to rotate" maxAngle 0.45 } # Mobile part of the gun (ELEVATION) DEF NamluDondur Transform { children [ Transform { rotation 1.0 0.0 0.0 -1.57 children [ DEF NamluGROUP Group { children [ Transform { rotation 0.0 0.0 1.0 1.57 translation 1.0 2.2 0.2 children [ DEF Namlu Group { children [ DEF InNamlu Shape { geometry Cylinder { radius 0.08 } appearance Appearance { material Material { diffuseColor .3 .3 .3 shininess 0.6 } } } DEF HoleNamlu Shape { geometry Cylinder { height 2.02 radius 0.06 } appearance Appearance { material Material { diffuseColor .0 .0 .0 shininess 0.6 } } } DEF OutNamlu Shape { geometry Cylinder { height 1.2 radius 0.1 } appearance Appearance { material Material { diffuseColor .4 .4 .4 shininess .6 } } } DEF FireTransform Transform { rotation 0.0 0.0 1.0 -3.14 scale 0.0001 0.0001 0.00001 translation 0.0 -1.35 0.0 children [ DEF FireCone Shape { geometry Cone { bottomRadius 0.05 height 0.5 } appearance Appearance { material Material { diffuseColor 0.8 0.3 0.0 shininess 0.7 specularColor 0.8 0.3 0.0 } } } Transform { translation 0.0 -0.2 0.0 children [ DEF InnerFireCone Shape { geometry Cone { bottomRadius 0.051 height 0.2 } appearance Appearance { material Material { diffuseColor 1.0 0.6 0.0 shininess 0.7 specularColor 1.0 0.6 0.0 } } } DEF ChScale PositionInterpolator { key [ 0.04 0.08 0.12 0.16 0.2 0.24 0.28 0.32 0.36 0.4 0.44 0.48 0.52 0.56 0.6 0.64 0.68 0.72 0.76 0.8 0.84 0.86 0.9 0.94 1.0 ] keyValue [ 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 1.0 1.0 1.0 0.00001 0.00001 0.00001 ] } DEF fireTimer TimeSensor { cycleInterval 1.5 } ] } ] } ] } ] } Transform { rotation 0.0 0.0 1.0 1.57 translation 1.0 2.2 -0.2 children [ USE Namlu ] } Transform { rotation 0.0 0.0 1.0 1.57 translation 1.0 1.8 -0.2 children [ USE Namlu ] } Transform { rotation 0.0 0.0 1.0 1.57 translation 1.0 1.8 0.2 children [ USE Namlu ] } ] } ] } ] } ] } DEF TopSensor CylinderSensor { description "click and drag to rotate" maxAngle 1.7 minAngle -1.7 } # missing ROUTE for OrientationInterpolator, likely due to use of CylinderSensor DEF ButtonRotInter OrientationInterpolator { key [ 0.0 1.0 ] keyValue [ 0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.7 ] } ### Warning: no ROUTE found for OrientationInterpolator output DEF PortSideTimer TimeSensor { cycleInterval 3.0 enabled FALSE loop TRUE } Transform { rotation 0.0 0.0 1.0 0.3 translation -0.1 1.0 0.0 children [ Shape { geometry Cylinder { height 1.5 radius 0.7 } appearance USE GunAp } ] } ] } ] } ] } Transform { rotation 0 1 0 1.57 children [ Transform { rotation 1 0 0 -1.4 scale 1.4 1.4 1.4 translation 0 0 0.5 children [ DEF GunControl Group { children [ Transform { translation 0 0 3 children [ Group { children [ DEF MenuB Shape { geometry Box { size 0.5 0.2 0.00001 } appearance Appearance { material Material { diffuseColor 0 1 0 transparency 0.6 } } } Transform { translation -0.2 -0.05 0.005 children [ Shape { geometry Text { string [ "FIRE" ] fontStyle FontStyle { size 0.2 spacing 0.1 ### style='BOLD' } } appearance Appearance { material Material { diffuseColor 1.0 0.0 0.0 } } } ] } DEF FireSensor TouchSensor { description "touch to fire" } ] } ] } Transform { translation -0.25 -0.2 3 children [ Group { children [ USE MenuB Transform { translation -0.2 -0.05 0.005 children [ Shape { geometry Text { string [ "LROT" ] fontStyle FontStyle { size 0.18 spacing 0.1 ### style='BOLD' } } appearance Appearance { material Material { diffuseColor 1.0 0.0 0.0 } } } ] } DEF LRotSensor TouchSensor { description "touch to rotate left" } ] } ] } Transform { translation 0.25 -0.2 3 children [ Group { children [ USE MenuB Transform { translation -0.2 -0.05 0.005 children [ Shape { geometry Text { string [ "RROT" ] fontStyle FontStyle { size 0.18 spacing 0.1 ### style='BOLD' } } appearance Appearance { material Material { diffuseColor 1.0 0.0 0.0 } } } ] } DEF RRotSensor TouchSensor { description "touch to rotate right" } ] } ] } Transform { translation -0.25 -0.4 3 children [ Group { children [ USE MenuB Transform { translation -0.2 -0.05 0.005 children [ Shape { geometry Text { string [ "ELEV" ] fontStyle FontStyle { size 0.18 spacing 0.1 ### style='BOLD' } } appearance Appearance { material Material { diffuseColor 1.0 0.0 0.0 } } } ] } DEF ElevSensor TouchSensor { description "touch to elevate" } ] } ] } Transform { translation 0.25 -0.4 3 children [ Group { children [ USE MenuB Transform { translation -0.2 -0.05 0.005 children [ Shape { geometry Text { string [ "DESC" ] fontStyle FontStyle { size 0.18 spacing 0.1 ### style='BOLD' } } appearance Appearance { material Material { diffuseColor 1.0 0.0 0.0 } } } ] } DEF DescSensor TouchSensor { description "touch to depress downward" } ] } ] } ] } ] } ] } ROUTE TopSensor.rotation_changed TO TopDondur.set_rotation ROUTE NamluSensor.rotation_changed TO NamluDondur.set_rotation ROUTE fireTimer.fraction_changed TO ChScale.set_fraction ROUTE ChScale.value_changed TO FireTransform.set_scale ROUTE FireSensor.touchTime TO fireTimer.set_startTime ROUTE FireSensor.touchTime TO FireSound.set_startTime ROUTE PortSideTimer.fraction_changed TO ButtonRotInter.set_fraction ROUTE FireSensor.isActive TO PortSideTimer.set_enabled ROUTE LRotSensor.isActive TO RotUpdater.set_LRotation ROUTE RRotSensor.isActive TO RotUpdater.set_RRotation ROUTE TopDondur.rotation TO RotUpdater.get_CurRotation ROUTE RotUpdater.newRotation TO TopDondur.set_rotation ROUTE ElevSensor.isActive TO ElevDescUpdater.set_Elevation ROUTE DescSensor.isActive TO ElevDescUpdater.set_Descendance ROUTE NamluDondur.rotation TO ElevDescUpdater.get_CurOrientation ROUTE ElevDescUpdater.newOrientation TO NamluDondur.set_rotation