<?lua
  include("HUDTemplates3.oxo")
  include("stats.oxo")
  include("templates/spaceshipAssff.oxt")
  math.randomseed(344)
?>

<Level
 name         = "Physics"
 description  = "Just a few tests"
>
  <Scene
   ambientlight = "0.8, 0.8, 0.8"
   skybox       = "Orxonox/skyBoxBasic"
   gravity      = "0, -10, 0"
  >
    <Light type=directional position="0,0,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" />

    <StaticEntity
     position        = "0,0,0"
     name            = "floor"
     collisionType   = "static"
     friction        = 1
    >
      <attached>
        <Model position="0,0,0" scale=100 mesh="plane.mesh" />
        <Model position="0,-0.0001,0" roll=180 scale=100 mesh="plane.mesh" />
      </attached>
      <collisionShapes>
        <PlaneCollisionShape planeNormal="0,1,0" planeOffset=0 />
      </collisionShapes>
    </StaticEntity>

    <MovableEntity
     position        = "0,250,500"
     rotationaxis    = "1, 1, 1"
     rotationrate    = 360
     velocity        = "0, 0, -80"
     name            = "ship"
     collisionType   = "dynamic"
     friction        = 0.5
     mass            = 500
     restitution     = 0
    >
      <attached>
        <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
        <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
        <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />

        <!--Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
        <Model position="0,0,0" scale3D="10, 3, 5" mesh="cube.mesh" />
        <Model position="13,-1.3,0" scale3D="3, 1, 2" mesh="cube.mesh" />
        <Model position="-13,-1.3,0" scale3D="3, 1, 2" mesh="cube.mesh" />
        <Model position="0,0,7" scale3D="3, 2, 2" mesh="cube.mesh" />
        <Model position="0,0.1,-11" scale3D="2.2, 1.8, 6" mesh="cube.mesh" />
        <Model position="0,0.1,-19" scale3D="1.4, 1, 2" mesh="cube.mesh" /-->
      </attached>
      <collisionShapes>
        <BoxCollisionShape position="0,0,0"      halfExtents="10, 3, 5" />
        <BoxCollisionShape position="13,-1.3,0"  halfExtents="3, 1, 2" />
        <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
        <BoxCollisionShape position="0,0,7"      halfExtents="3, 2, 2" />
        <BoxCollisionShape position="0,0.1,-11"  halfExtents="2.2, 1.8, 6" />
        <BoxCollisionShape position="0,0.1,-19"  halfExtents="1.4, 1, 2" />
      </collisionShapes>
    </MovableEntity>

    <?lua
    for i = -20, 20, 8
    do
      for i2 = -20, 20, 8
      do
        for i3 = -20, 20, 8
        do ?>
        <MovableEntity
         position="<?lua print(i)?>, <?lua print(i3 + 250)?>, <?lua print(i2) ?>"
         collisionType = "dynamic"
         mass = 1
         restitution = 0
         friction = 0.5
        >
          <attached>
            <Model position="0,0,0" scale=2 mesh="cube.mesh" />
          </attached>
          <collisionShapes>
            <BoxCollisionShape halfExtents="2, 2, 2" />
          </collisionShapes>
        </MovableEntity>
    <?lua
        end
      end
    end
    ?>

    <ParticleSpawner position="-100,170,30" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
      <events>
        <spawn>
          <EventTrigger delay=1>
            <events>
              <trigger>
                <SpawnPoint position="-100,170,30" spawnclass=SpaceShip pawndesign=spaceshipassff />
              </trigger>
            </events>
          </EventTrigger>
        </spawn>
      </events>
    </ParticleSpawner>
  </Scene>
</Level>