<LevelInfo
 name = "Earth Demonstration"
 description = "1:100 Scale Model of Earth with Gravity"
 tags = "showcase"
 screenshot = "earthdemonstration.png"
/>

<?lua
  include("stats.oxo")
  include("HUDTemplates3.oxo")
  include("templates/lodInformation.oxt")
  include("templates/spaceshipHXY.oxt")
?>

<Level>
  <templates>
    <Template link="lodtemplate_default" />
  </templates>
  <?lua include("includes/notifications.oxi") ?>

  <Template name=PortalDefault>
      <PortalEndPoint>
          <attached>
              <Billboard material="Portals/Default" />
          </attached>
      </PortalEndPoint>
  </Template>

  <Scene
    ambientlight = "0.8, 0.8, 0.8"
    skybox       = "Orxonox/skyboxempty"
  >
    <WorldAmbientSound
      source="Earth.ogg"
      looping="true"
      playOnLoad="true"
    />

    <Light
      type="directional"
      position="-500000,-500000,0"
      direction="0.253, 0.593, -0.765"
      diffuse="1.0, 0.9, 0.9, 1.0"
      specular="1.0, 0.9, 0.9, 1.0"
    />



    <SpawnPoint
      position="70000,0,0"
      lookat="0,0,0"
      spawnclass="SpaceShip"
      pawndesign="spaceshipHXY"
    />
    <PortalEndPoint position="70500,100,0" id="1" distance="40" target="MobileEntity" design="PortalDefault"/>

    <!-- This is a model of Earth: mass=EarthMass/1000 and radius=EarthRadius[km]*10 -->
    <Planet
      position="0,0,0"
      scale="63000"
      collisionType="dynamic"
      linearDamping="0.8"
      angularDamping="0"
      mass="5.9e21"
      pitch="0"
      mesh="planets/earth.mesh"
      atmosphere="atmosphere1"
      rotationaxis="0,1,0"
      rotationrate="0.2"
      atmospheresize="80.0f"
      imagesize="1024.0f"
      collisiondamage = 2
      enablecollisiondamage = true
    >
      <attached>
        <ForceField position="0,0,0" mode="newtonianGravity" diameter="140000" massDiameter="126000" mass="5.9e21" />
      </attached>
      <collisionShapes>
        <SphereCollisionShape radius="63000" position="0,0,0" />
      </collisionShapes>
    </Planet>

    <!-- This is a model of our Moon: mass=MoonMass/1000 and radius=MoonRadius[km]*10 and position=DistanceFromEarth[km]*10 -->
    <Planet
      position="3625700,0,0"
      scale="17370"
      collisionType="dynamic"
      linearDamping="0.8"
      angularDamping="0"
      mass="7.36e19"
      pitch="0"
      mesh="planets/moon.mesh"
      atmosphere="atmosphere1"
      rotationaxis="0,1,0"
      rotationrate="0.2"
      atmospheresize="80.0f"
      imagesize="1024.0f"
      collisiondamage = 2
      enablecollisiondamage = true
    >
      <attached>
        <ForceField position="0,0,0" mode="newtonianGravity" diameter="40000" massDiameter="34740" mass="7.36e19" />
      </attached>
      <collisionShapes>
        <SphereCollisionShape radius="17370" position="0,0,0" />
      </collisionShapes>
    </Planet>
    <PortalEndPoint position="3603330,100,0" id="2" distance="40" target="MobileEntity" design="PortalDefault"/>

    <!-- Create portals from Earth to the Moon -->
    <PortalLink fromID="1" toID="2" />
    <PortalLink fromID="2" toID="1" />
  </Scene>
</Level>