{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.3",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.3.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"SphericalMinePrototype.x3d"
          },
          {
            "@name":"description",
            "@content":"Underwater mine prototype SphericalMine. Note level of detail (LOD) transitions when seen at transition ranges."
          },
          {
            "@name":"creator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"26 June 2000"
          },
          {
            "@name":"modified",
            "@content":"2 September 2024"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/SphericalMinePrototype.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../../license.html"
          },
          {
            "@name":"translated",
            "@content":"26 March 2026"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, https://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"reference",
            "@content":"X3D JSON encoding: https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          {
            "#comment":"SphericalMine is a simple notional mine"
          },
          { "WorldInfo":
            {
              "@title":"SphericalMinePrototype.x3d"
            }
          },
          { "ProtoDeclare":
            {
              "@name":"SphericalMine",
              "@appinfo":"Spherical floating mine moored to bottom",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"description",
                      "@accessType":"initializeOnly",
                      "@appinfo":"Description for each mine contact.",
                      "@type":"SFString",
                      "@value":"10 m: Spherical Mine"
                    },
                    {
                      "@name":"color",
                      "@accessType":"inputOutput",
                      "@appinfo":"Mine color can be used to indicate status (found/unknown/disabled/) tactic etc.",
                      "@type":"SFColor",
                      "@value":[0.8,0.8,0.8]
                    },
                    {
                      "@name":"translation",
                      "@accessType":"inputOutput",
                      "@appinfo":"Location of mine center in local world coordinates.",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    },
                    {
                      "@name":"scale",
                      "@accessType":"inputOutput",
                      "@appinfo":"Scale factor to change spherical mine size default diameter = 1m.",
                      "@type":"SFVec3f",
                      "@value":[1,1,1]
                    },
                    {
                      "@name":"bboxCenter",
                      "@accessType":"initializeOnly",
                      "@appinfo":"Bounding box for collision detection of mine.",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    },
                    {
                      "@name":"tetherPoints",
                      "@accessType":"inputOutput",
                      "@appinfo":"Top and bottom endpoints of line tether that anchors this mine to the bottom.",
                      "@type":"MFVec3f",
                      "@value":[0,0,0,0,-10,0]
                    },
                    {
                      "@name":"proximityIsActive",
                      "@accessType":"outputOnly",
                      "@appinfo":"proximityIsActive can be used to activate information or interaction when the viewer nears the mine.",
                      "@type":"SFBool"
                    },
                    {
                      "@name":"proximitySize",
                      "@accessType":"inputOutput",
                      "@appinfo":"proximitySize provides overall box dimensions for proximity; thus (10 10 10) yields approximate radius 5 to 7 meters.",
                      "@type":"SFVec3f",
                      "@value":[10,10,10]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "Transform":
                      {
                        "@DEF":"LOCATOR",
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"translation",
                                "@protoField":"translation"
                              },
                              {
                                "@nodeField":"scale",
                                "@protoField":"scale"
                              },
                              {
                                "@nodeField":"bboxCenter",
                                "@protoField":"bboxCenter"
                              }
                            ]
                        },
                        "-children":[
                          { "LOD":
                            {
                              "@range":[100,500,5000],
                              "-children":[
                                {
                                  "#comment":"High resolution"
                                },
                                { "Group":
                                  {
                                    "-children":[
                                      { "Viewpoint":
                                        {
                                          "@DEF":"UW_MINE_VIEWPOINT",
                                          "IS": {
                                              "connect": [
                                                {
                                                  "@nodeField":"description",
                                                  "@protoField":"description"
                                                }
                                              ]
                                          }
                                        }
                                      },
                                      { "ProximitySensor":
                                        {
                                          "@DEF":"UW_MINE_PROXIMITY",
                                          "IS": {
                                              "connect": [
                                                {
                                                  "@nodeField":"isActive",
                                                  "@protoField":"proximityIsActive"
                                                },
                                                {
                                                  "@nodeField":"size",
                                                  "@protoField":"proximitySize"
                                                }
                                              ]
                                          }
                                        }
                                      },
                                      { "Shape":
                                        {
                                          "@DEF":"UW_MINE_SPHERE",
                                          "-geometry":
                                            { "Sphere":
                                              {
                                                "@radius":0.5
                                              }
                                            },
                                          "-appearance":
                                            { "Appearance":
                                              {
                                                "@DEF":"UW_MINE_APPEARANCE",
                                                "-material":
                                                  { "Material":
                                                    {
                                                      "@DEF":"UW_MINE_MATERIAL",
                                                      "@shininess":0.5,
                                                      "IS": {
                                                          "connect": [
                                                            {
                                                              "@nodeField":"diffuseColor",
                                                              "@protoField":"color"
                                                            }
                                                          ]
                                                      }
                                                    }
                                                  }
                                              }
                                            }
                                        }
                                      },
                                      { "Transform":
                                        {
                                          "@translation":[0,0.49,0],
                                          "-children":[
                                            { "Transform":
                                              {
                                                "@DEF":"SPIKE",
                                                "@center":[0,-0.1,0],
                                                "@translation":[0,0.1,0],
                                                "-children":[
                                                  { "Shape":
                                                    {
                                                      "-geometry":
                                                        { "Cone":
                                                          {
                                                            "@bottom":false,
                                                            "@bottomRadius":0.05,
                                                            "@height":0.2
                                                          }
                                                        },
                                                      "-appearance":
                                                        { "Appearance":
                                                          {
                                                            "-material":
                                                              { "Material":
                                                                {
                                                                  "@diffuseColor":[0.8,0.8,0.8],
                                                                  "@shininess":0.5,
                                                                  "@specularColor":[0.2,0.2,0.2]
                                                                }
                                                              }
                                                          }
                                                        }
                                                    }
                                                  }
                                                ]
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      { "Transform":
                                        {
                                          "@rotation":[0,0,1,3.1416],
                                          "@translation":[0,-0.49,0],
                                          "-children":[
                                            { "Transform":
                                              {
                                                "@USE":"SPIKE"
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      { "Transform":
                                        {
                                          "@rotation":[0,0,1,-1.57079],
                                          "@translation":[0.49,0,0],
                                          "-children":[
                                            { "Transform":
                                              {
                                                "@USE":"SPIKE"
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      { "Transform":
                                        {
                                          "@rotation":[0,0,1,1.57079],
                                          "@translation":[-0.49,0,0],
                                          "-children":[
                                            { "Transform":
                                              {
                                                "@USE":"SPIKE"
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      { "Transform":
                                        {
                                          "@rotation":[1,0,0,1.57079],
                                          "@translation":[0,0,0.49],
                                          "-children":[
                                            { "Transform":
                                              {
                                                "@USE":"SPIKE"
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      { "Transform":
                                        {
                                          "@rotation":[1,0,0,-1.57079],
                                          "@translation":[0,0,-0.49],
                                          "-children":[
                                            { "Transform":
                                              {
                                                "@USE":"SPIKE"
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      { "Shape":
                                        {
                                          "-geometry":
                                            { "IndexedLineSet":
                                              {
                                                "@coordIndex":[0,1,-1],
                                                "-coord":
                                                  { "Coordinate":
                                                    {
                                                      "@DEF":"UW_MINE_TETHER",
                                                      "IS": {
                                                          "connect": [
                                                            {
                                                              "@nodeField":"point",
                                                              "@protoField":"tetherPoints"
                                                            }
                                                          ]
                                                      }
                                                    }
                                                  }
                                              }
                                            }
                                        }
                                      }
                                    ]
                                  }
                                },
                                {
                                  "#comment":"Medium resolution"
                                },
                                { "Group":
                                  {
                                    "-children":[
                                      { "Viewpoint":
                                        {
                                          "@DEF":"UW_MINE_VIEWPOINT_MEDIUM",
                                          "IS": {
                                              "connect": [
                                                {
                                                  "@nodeField":"description",
                                                  "@protoField":"description"
                                                }
                                              ]
                                          }
                                        }
                                      },
                                      { "Shape":
                                        {
                                          "@USE":"UW_MINE_SPHERE"
                                        }
                                      }
                                    ]
                                  }
                                },
                                {
                                  "#comment":"Low resolution"
                                },
                                { "Shape":
                                  {
                                    "-geometry":
                                      { "Box":
                                        {
                                          "@size":[12,12,12]
                                        }
                                      },
                                    "-appearance":
                                      { "Appearance":
                                        {
                                          "@USE":"UW_MINE_APPEARANCE"
                                        }
                                      }
                                  }
                                },
                                {
                                  "#comment":"No resolution"
                                },
                                { "WorldInfo":
                                  {
                                    "@info":["null geometry"]
                                  }
                                }
                              ]
                            }
                          }
                        ]
                      }
                    }
                  ]
              }
            }
          },
          {
            "#comment":"Show default geometry, in case this Prototype library is viewed directly as a scene"
          },
          { "Group":
            {
              "@DEF":"ShowSphericalMines",
              "-children":[
                { "ProtoInstance":
                  {
                    "@name":"SphericalMine",
                    "@DEF":"BLUE_SPHERICAL_MINE",
                    "fieldValue": [
                      {
                        "@name":"description",
                        "@value":"10 m: blue SphericalMine default viewpoint"
                      },
                      {
                        "@name":"color",
                        "@value":[0,0,0.8]
                      },
                      {
                        "@name":"translation",
                        "@value":[0,-10,0]
                      },
                      {
                        "@name":"bboxCenter",
                        "@value":[1,1,1]
                      },
                      {
                        "@name":"tetherPoints",
                        "@value":[0,0,0,0,-10.0,0]
                      }
                    ]
                  }
                },
                { "ProtoInstance":
                  {
                    "@name":"SphericalMine",
                    "@DEF":"GREEN_SPHERICAL_MINE",
                    "fieldValue": [
                      {
                        "@name":"description",
                        "@value":"10 m: green SphericalMine default viewpoint"
                      },
                      {
                        "@name":"color",
                        "@value":[0,0.8,0]
                      },
                      {
                        "@name":"translation",
                        "@value":[10,-10,0]
                      },
                      {
                        "@name":"bboxCenter",
                        "@value":[2,2,2]
                      },
                      {
                        "@name":"tetherPoints",
                        "@value":[0,0,0,0,-10.0,0]
                      }
                    ]
                  }
                },
                { "Background":
                  {
                    "@groundColor":[0,0.2,0.2],
                    "@skyColor":[0,0.3,0.3]
                  }
                },
                { "Viewpoint":
                  {
                    "@description":"1 m: one closeup SphericalMine",
                    "@position":[10,-10,2]
                  }
                },
                { "Viewpoint":
                  {
                    "@description":"10 m: two pointy SphericalMines",
                    "@position":[5,-10,10]
                  }
                },
                { "Viewpoint":
                  {
                    "@description":"100+ m: two round SphericalMines",
                    "@position":[5,-10,105]
                  }
                },
                { "Viewpoint":
                  {
                    "@description":"500+ m: two boxy SphericalMines",
                    "@position":[5,-10,510]
                  }
                },
                { "Viewpoint":
                  {
                    "@description":"5000+ m: two invisible SphericalMines",
                    "@position":[5,-10,5010]
                  }
                }
              ]
            }
          },
          {
            "#comment":"Proximity activation triggers switch in NavigationInfo mode between EXAMINE and WALK - pretty cool!"
          },
          { "NavigationInfo":
            {
              "@DEF":"NAVIGATION",
              "@speed":20,
              "@type":["WALK","EXAMINE","ANY"]
            }
          },
          { "Script":
            {
              "@DEF":"NAVIGATION_MODE",
              "field": [
                {
                  "@name":"inProximity",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"type",
                  "@accessType":"outputOnly",
                  "@type":"MFString"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"",
"function inProximity ( value, eventTime )",
"{",
" if ( value == true )",
" {",
"\ttype[0] = 'EXAMINE';",
"\ttype[1] = 'WALK';",
"\ttype[2] = 'ANY';",
" }",
" else",
" {",
"\ttype[0] = 'WALK';",
"\ttype[1] = 'EXAMINE';",
"\ttype[2] = 'ANY';",
" }",
" // Browser.println ('inProximity=' + value + ', type=' + type);",
"}",
"",
""
]
            }
          },
          { "ROUTE":
            {
              "@fromField":"proximityIsActive",
              "@fromNode":"BLUE_SPHERICAL_MINE",
              "@toField":"inProximity",
              "@toNode":"NAVIGATION_MODE"
            }
          },
          { "ROUTE":
            {
              "@fromField":"proximityIsActive",
              "@fromNode":"GREEN_SPHERICAL_MINE",
              "@toField":"inProximity",
              "@toNode":"NAVIGATION_MODE"
            }
          },
          {
            "#comment":"TODO match field name in Script exactly"
          },
          { "ROUTE":
            {
              "@fromField":"type",
              "@fromNode":"NAVIGATION_MODE",
              "@toField":"set_type",
              "@toNode":"NAVIGATION"
            }
          }
        ]
    }
  }
}