Index: trunk/src/world_entities/Makefile.am
===================================================================
--- trunk/src/world_entities/Makefile.am	(revision 6634)
+++ trunk/src/world_entities/Makefile.am	(revision 6637)
@@ -51,4 +51,5 @@
                   world_entities/space_ships/space_ship.cc \
                   world_entities/space_ships/helicopter.cc \
+                  world_entities/space_ships/hover.cc \
                   world_entities/creatures/md2_creature.cc \
                   \
@@ -102,4 +103,5 @@
                  world_entities/space_ships/space_ship.h \
                  world_entities/space_ships/helicopter.h \
+                 world_entities/space_ships/hover.h \
                  world_entities/creatures/md2_creature.h \
                  \
Index: trunk/src/world_entities/projectiles/guided_missile.cc
===================================================================
--- trunk/src/world_entities/projectiles/guided_missile.cc	(revision 6634)
+++ trunk/src/world_entities/projectiles/guided_missile.cc	(revision 6637)
@@ -43,5 +43,5 @@
   this->setMaxEnergy(10);
   this->lifeSpan = 10.0;
-  this->agility = 500;
+  this->agility = 5;
   this->maxVelocity = 75;
 
Index: trunk/src/world_entities/space_ships/helicopter.cc
===================================================================
--- trunk/src/world_entities/space_ships/helicopter.cc	(revision 6634)
+++ trunk/src/world_entities/space_ships/helicopter.cc	(revision 6637)
@@ -117,12 +117,12 @@
   bFire = false;
   xMouse = yMouse = 0;
-  mouseSensitivity = 0.001;
-  rotorspeed = 1;
-  tailrotorspeed = 0;
-
-  cycle = 0.0;
-
-
-  travelSpeed = 15.0;
+  mouseSensitivity = 0.05;
+  //rotorspeed = 1;
+  //tailrotorspeed = 0;
+
+  //cycle = 0.0;
+
+
+  //travelSpeed = 15.0;
   this->velocity = Vector(0.0,0.0,0.0);
   this->velocityDir = Vector(1.0,0.0,0.0);
@@ -134,9 +134,9 @@
 
   //add events to the eventlist
-  registerEvent(SDLK_w);
-  registerEvent(SDLK_s);
-  registerEvent(SDLK_a);
-  registerEvent(SDLK_d);
-  registerEvent(SDLK_q);
+  registerEvent(KeyMapper::PEV_UP);
+  registerEvent(KeyMapper::PEV_DOWN);
+  registerEvent(KeyMapper::PEV_LEFT);
+  registerEvent(KeyMapper::PEV_RIGHT);
+  //registerEvent(SDLK_q);
   registerEvent(SDLK_e);
   registerEvent(SDLK_c);
@@ -144,6 +144,6 @@
   registerEvent(KeyMapper::PEV_NEXT_WEAPON);
   registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
-  registerEvent(SDLK_PAGEUP);
-  registerEvent(SDLK_PAGEDOWN);
+  //registerEvent(SDLK_PAGEUP);
+  //registerEvent(SDLK_PAGEDOWN);
   registerEvent(EV_MOUSE_MOTION);
 
@@ -249,4 +249,5 @@
 void Helicopter::tick (float time)
 {
+  /*
   tailrotorspeed += xMouse/20;
   if (tailrotorspeed >= 0.07) tailrotorspeed = 0.07;
@@ -256,21 +257,27 @@
   else if (tailrotorspeed < -0.0008) tailrotorspeed += 0.001;
   if (tailrotorspeed <= 0.001 && tailrotorspeed >= -0.001) tailrotorspeed = 0;
-
+  */
+  
   // spaceship controlled movement
   this->calculateVelocity(time);
 
-  Vector move = (velocity);
+  Vector move = (velocity)*time;
 
   // this is the air friction (necessary for a smooth control)
   if(velocity.len() != 0) velocity -= velocity*0.1;
+  
+  //travelSpeed = velocity.len();
 
   //physics: Gravity
-  this->shiftCoor(Vector(0,-1,0));
+  /*this->shiftCoor(Vector(0,-1,0));
 
   this->shiftCoor(getAbsDirY()*rotorspeed);
-
+  */
+  
+  /*
   //hoover effect
   cycle += time;
   this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
+  */
 
   //readjust
@@ -281,5 +288,5 @@
 
   this->shiftCoor (move);
-  this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
+  //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
 
   this->getWeaponManager()->tick(time);
@@ -295,6 +302,6 @@
 {
   Vector accel(0.0, 0.0, 0.0);
-  Vector rot(0.0, 0.0, 0.0);
-  float rotVal = 0.0;
+  float rotValX = 0.0;
+  float rotValZ = 0.0;
   /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
   /* calculate the direction in which the craft is heading  */
@@ -304,10 +311,11 @@
      //this->shiftCoor(this->getAbsDirX());
      //accel -= this->getAbsDirY();
-     rot += Vector (0,0,1);
-     rotVal -= time/5;
+     
+     accel += Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
+     if((this->getAbsDirX()).y >= -0.1) rotValZ -= time;
    }
    else
    {
-       if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time/8, Vector(0,0,1)));
+       if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time, Vector(0,0,1)));
    }
 
@@ -316,10 +324,11 @@
      //this->shiftCoor((this->getAbsDirX())*-1);
      //accel -= this->getAbsDirY();
-     rot += Vector (0,0,1);
-     rotVal += time/5;
+     
+     accel -= Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
+     rotValZ += time;
    }
    else
    {
-         if(this->getAbsDirX().y > 0.02) this->shiftDir(Quaternion(-time/8, Vector(0,0,1)));
+         if(this->getAbsDirX().y > 0.02) this->shiftDir(Quaternion(-time, Vector(0,0,1)));
    }
 
@@ -329,10 +338,11 @@
     //accel -= this->getAbsDirY();
     //velocityDir.normalize();
-    rot += Vector(1,0,0);
-    rotVal -= time/5;
+    
+    accel -= Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
+    rotValX -= time;
   }
   else
    {
-         if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(time/5, Vector(1,0,0)));
+         if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(time, Vector(1,0,0)));
    }
 
@@ -340,12 +350,13 @@
   {
     //this->shiftDir(Quaternion(-time, Vector(0,1,0)));
-    accel += this->getAbsDirY();
+    //accel += this->getAbsDirY();
     //velocityDir.normalize();
-    rot += Vector(1,0,0);
-    rotVal += time/5;
+    
+    accel += Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
+    rotValX += time;
   }
   else
    {
-         if(this->getAbsDirZ().y < -0.02) this->shiftDir(Quaternion(-time/5, Vector(1,0,0)));
+         if(this->getAbsDirZ().y < -0.02) this->shiftDir(Quaternion(-time, Vector(1,0,0)));
    }
 
@@ -371,6 +382,7 @@
     //this->shiftDir(Quaternion(time, Vector(0,0,1)));
 
-    rotorspeed += 0.05;
-    if (rotorspeed >= 2) rotorspeed = 2;
+    accel += this->getAbsDirY();
+    //rotorspeed += 0.05;
+    //if (rotorspeed >= 2) rotorspeed = 2;
     //velocityDir.normalize();
     //rot += Vector(0,0,1);
@@ -379,5 +391,5 @@
   else
   {
-    if(rotorspeed >= 1.05) rotorspeed -= 0.05;
+    //if(rotorspeed >= 1.05) rotorspeed -= 0.05;
   }
 
@@ -386,6 +398,7 @@
     //this->shiftDir(Quaternion(-time, Vector(0,0,1)));
 
-    rotorspeed -= 0.05;
-    if (rotorspeed <= 0) rotorspeed = 0;
+    accel -= this->getAbsDirY();
+    //rotorspeed -= 0.05;
+    //if (rotorspeed <= 0) rotorspeed = 0;
     //velocityDir.normalize();
     //rot += Vector(0,0,1);
@@ -394,10 +407,10 @@
   else
   {
-    if(rotorspeed <= 0.05) rotorspeed += 0.05;
-  }
-
-  //velocity += accel;
-  rot.normalize();
-  this->shiftDir(Quaternion(rotVal, rot));
+    //if(rotorspeed <= 0.05) rotorspeed += 0.05;
+  }
+
+  velocity += accel*3;
+  if((this->getAbsDirX()).y <= 0.3 && (this->getAbsDirX()).y >= -0.3) this->shiftDir(Quaternion(rotValZ, Vector(0,0,1)));
+  if((this->getAbsDirZ()).y <= 0.3 && (this->getAbsDirZ()).y >= -0.3) this->shiftDir(Quaternion(rotValX, Vector(1,0,0)));
 }
 
@@ -429,7 +442,7 @@
 
 
-  if( event.type == SDLK_a)
+  if( event.type == KeyMapper::PEV_LEFT)
       this->bLeft = event.bPressed;
-  else if( event.type == SDLK_d)
+  else if( event.type == KeyMapper::PEV_RIGHT)
       this->bRight = event.bPressed;
   else if( event.type == KeyMapper::PEV_FIRE1)
@@ -443,7 +456,7 @@
   else if( event.type == SDLK_c)
     this->bDescend = event.bPressed; //this->shiftCoor(0,-.1,0);
-  else if( event.type == SDLK_w)
+  else if( event.type == KeyMapper::PEV_UP)
     this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
-  else if( event.type == SDLK_s)
+  else if( event.type == KeyMapper::PEV_DOWN)
     this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0);
   else if( event.type == EV_MOUSE_MOTION)
@@ -452,5 +465,5 @@
     this->yMouse = event.yRel*mouseSensitivity;
 
-    //this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
+    this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))/*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))*/);
   }
 }
Index: trunk/src/world_entities/space_ships/helicopter.h
===================================================================
--- trunk/src/world_entities/space_ships/helicopter.h	(revision 6634)
+++ trunk/src/world_entities/space_ships/helicopter.h	(revision 6637)
@@ -57,6 +57,7 @@
     float                 xMouse;             //!< mouse moved in x-Direction
     float                 yMouse;             //!< mouse moved in y-Direction
+    int                   yInvert;
     float                 mouseSensitivity;   //!< the mouse sensitivity
-    float                 cycle;              //!< hovercycle
+    //float                 cycle;              //!< hovercycle
 
     Vector                velocity;           //!< the velocity of the player.
@@ -64,6 +65,6 @@
     float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
     float                 acceleration;       //!< the acceleration of the player.
-    float                 rotorspeed;         //!< the speed of the rotor.
-    float                 tailrotorspeed;     //!< the relativ speed ot the tail rotor
+    //float                 rotorspeed;         //!< the speed of the rotor.
+    //float                 tailrotorspeed;     //!< the relativ speed ot the tail rotor
 
     float                 airViscosity;
Index: trunk/src/world_entities/space_ships/hover.cc
===================================================================
--- trunk/src/world_entities/space_ships/hover.cc	(revision 6637)
+++ trunk/src/world_entities/space_ships/hover.cc	(revision 6637)
@@ -0,0 +1,476 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Benjamin Knecht
+   co-programmer: ...
+
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "hover.h"
+
+#include "weapons/weapon_manager.h"
+#include "weapons/test_gun.h"
+#include "weapons/turret.h"
+#include "weapons/cannon.h"
+
+#include "factory.h"
+#include "key_mapper.h"
+#include "event_handler.h"
+#include "state.h"
+
+#include "graphics_engine.h"
+
+using namespace std;
+
+CREATE_FACTORY(Hover, CL_HOVER);
+
+/**
+ *  creates the controlable Spaceship
+ */
+Hover::Hover()
+{
+  this->init();
+}
+
+/**
+ *  destructs the spaceship, deletes alocated memory
+ */
+Hover::~Hover ()
+{
+}
+
+/**
+ * loads a Spaceships information from a specified file.
+ * @param fileName the name of the File to load the spaceship from (absolute path)
+ */
+Hover::Hover(const char* fileName)
+{
+  this->init();
+  TiXmlDocument doc(fileName);
+
+  if(!doc.LoadFile())
+  {
+    PRINTF(2)("Loading file %s failed for Hover.\n", fileName);
+    return;
+  }
+
+  this->loadParams(doc.RootElement());
+}
+
+/**
+ *  creates a new Spaceship from Xml Data
+ * @param root the xml element containing spaceship data
+
+   @todo add more parameters to load
+*/
+Hover::Hover(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+
+  //weapons:
+  Weapon* wpRight = new TestGun(0);
+  wpRight->setName("testGun Right");
+  Weapon* wpLeft = new TestGun(1);
+  wpLeft->setName("testGun Left");
+  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
+
+  cannon->setName("BFG");
+
+  this->addWeapon(wpLeft, 1, 0);
+  this->addWeapon(wpRight,1 ,1);
+  this->addWeapon(cannon, 0, 6);
+
+  //this->addWeapon(turret, 3, 0);
+
+  this->getWeaponManager()->changeWeaponConfig(1);
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+}
+
+
+/**
+ * initializes a Hover
+ */
+void Hover::init()
+{
+//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
+  this->setClassID(CL_HOVER, "Hover");
+
+  PRINTF(4)("HOVER INIT\n");
+
+  this->loadModel("models/ships/fighter.obj", 1.0);
+
+  EventHandler::getInstance()->grabEvents(true);
+
+  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
+  bFire = false;
+  xMouse = yMouse = 0;
+  mouseSensitivity = 0.05;
+
+
+  this->velocity = Vector(0.0,0.0,0.0);
+  this->velocityDir = Vector(1.0,0.0,0.0);
+
+//   GLGuiButton* button = new GLGuiPushButton();
+//   button->show();
+//   button->setLabel("orxonox");
+//   button->setBindNode(this);
+
+  //add events to the eventlist
+  registerEvent(KeyMapper::PEV_UP);
+  registerEvent(KeyMapper::PEV_DOWN);
+  registerEvent(KeyMapper::PEV_LEFT);
+  registerEvent(KeyMapper::PEV_RIGHT);
+  registerEvent(SDLK_e);
+  registerEvent(SDLK_c);
+  registerEvent(KeyMapper::PEV_FIRE1);
+  registerEvent(KeyMapper::PEV_NEXT_WEAPON);
+  registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
+  registerEvent(EV_MOUSE_MOTION);
+
+  this->getWeaponManager()->setSlotCount(7);
+
+  this->getWeaponManager()->setSlotPosition(0, Vector(-2.6, .1, -3.0));
+  this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(1, Vector(-2.6, .1, 3.0));
+  this->getWeaponManager()->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(2, Vector(-1.5, .5, -.5));
+  this->getWeaponManager()->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(3, Vector(-1.5, .5, .5));
+  this->getWeaponManager()->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(4, Vector(-1.5, -.5, .5));
+  this->getWeaponManager()->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5));
+  this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
+//
+   this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0));
+   this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+   //
+//   this->getWeaponManager()->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
+//   this->getWeaponManager()->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
+//
+//   this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
+//   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
+
+  this->getWeaponManager()->getFixedTarget()->setParent(this);
+  this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
+
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+
+}
+
+/**
+ * loads the Settings of a Helicopter from an XML-element.
+ * @param root the XML-element to load the Spaceship's properties from
+ */
+void Hover::loadParams(const TiXmlElement* root)
+{
+  static_cast<WorldEntity*>(this)->loadParams(root);
+}
+
+
+
+
+void Hover::enter()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
+  this->attachCamera();
+
+
+}
+
+void Hover::leave()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+  this->detachCamera();
+
+}
+
+
+/**
+ *  effect that occurs after the Helicopter is spawned
+*/
+void Hover::postSpawn ()
+{
+  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
+}
+
+/**
+ *  the action occuring if the spaceship left the game
+*/
+void Hover::leftWorld ()
+{}
+
+/**
+ *  this function is called, when two entities collide
+ * @param entity: the world entity with whom it collides
+ *
+ * Implement behaviour like damage application or other miscellaneous collision stuff in this function
+ */
+void Hover::collidesWith(WorldEntity* entity, const Vector& location)
+{
+  if (entity->isA(CL_TURRET_POWER_UP))
+  {
+    this->ADDWEAPON();
+    }
+//  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
+}
+
+
+
+/**
+ *  the function called for each passing timeSnap
+ * @param time The timespan passed since last update
+*/
+void Hover::tick (float time)
+{
+  
+  
+  Quaternion xDir = Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0));
+  Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1));
+    
+  if ((this->getAbsDirY()).y < 0.8)
+  {
+     if((this->getAbsDirX()).y > 0)
+     {
+        if(yMouse > 0)  this->shiftDir(xDir*yDir);
+        else this->shiftDir(xDir);
+     }
+     else
+     {
+         if(yMouse < 0) this->shiftDir(xDir*yDir);
+         else this->shiftDir(xDir);
+     }
+  }
+  else this->shiftDir(xDir*yDir);
+  
+  if((this->getAbsDirZ()).y > 0.1) this->shiftDir(Quaternion(0.01,Vector(1,0,0)));
+  else if((this->getAbsDirZ()).y < -0.1) this->shiftDir(Quaternion(-0.01,Vector(1,0,0)));
+
+  
+  // spaceship controlled movement
+  this->calculateVelocity(time);
+
+  Vector move = (velocity)*time;
+
+  // this is the air friction (necessary for a smooth control)
+  if(velocity.len() != 0) velocity -= velocity*0.1;
+
+  //readjust
+ // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
+  //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
+
+  //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
+
+  this->shiftCoor (move);
+  //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
+
+  this->getWeaponManager()->tick(time);
+  // weapon system manipulation
+  this->weaponAction();
+}
+
+/**
+ *  calculate the velocity
+ * @param time the timeslice since the last frame
+*/
+void Hover::calculateVelocity (float time)
+{
+  Vector accel(0.0, 0.0, 0.0);
+  float rotValX = 0.0;
+  float rotValZ = 0.0;
+  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
+  /* calculate the direction in which the craft is heading  */
+
+  if( this->bUp )
+   {
+     //this->shiftCoor(this->getAbsDirX());
+     //accel -= this->getAbsDirY();
+     
+     accel += Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
+     //if((this->getAbsDirX()).y >= -0.1) rotValZ -= time;
+   }
+
+  if( this->bDown )
+   {
+     //this->shiftCoor((this->getAbsDirX())*-1);
+     //accel -= this->getAbsDirY();
+     
+     accel -= Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
+     //rotValZ += time;
+   }
+
+  if( this->bLeft /* > -this->getRelCoor().z*2*/)
+  {
+    //this->shiftDir(Quaternion(time, Vector(0,1,0)));
+    //accel -= this->getAbsDirY();
+    //velocityDir.normalize();
+    
+    accel -= Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
+    //rotValX -= time;
+  }
+
+  if( this->bRight /* > this->getRelCoor().z*2*/)
+  {
+    //this->shiftDir(Quaternion(-time, Vector(0,1,0)));
+    //accel += this->getAbsDirY();
+    //velocityDir.normalize();
+    
+    accel += Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
+    //rotValX += time;
+  }
+
+  if( this->bRollL /* > -this->getRelCoor().z*2*/)
+  {
+    this->shiftDir(Quaternion(-time, Vector(1,0,0)));
+    //accel -= rightDirection;
+    //velocityDir.normalize();
+    //rot +=Vector(1,0,0);
+    //rotVal -= .4;
+  }
+  if( this->bRollR /* > this->getRelCoor().z*2*/)
+  {
+    this->shiftDir(Quaternion(time, Vector(1,0,0)));
+
+    //accel += rightDirection;
+    //velocityDir.normalize();
+    //rot += Vector(1,0,0);
+    //rotVal += .4;
+  }
+  if (this->bAscend )
+  {
+    //this->shiftDir(Quaternion(time, Vector(0,0,1)));
+
+    accel += this->getAbsDirY();
+    //rotorspeed += 0.05;
+    //if (rotorspeed >= 2) rotorspeed = 2;
+    //velocityDir.normalize();
+    //rot += Vector(0,0,1);
+    //rotVal += .4;
+  }
+  else
+  {
+    //if(rotorspeed >= 1.05) rotorspeed -= 0.05;
+  }
+
+  if (this->bDescend )
+  {
+    //this->shiftDir(Quaternion(-time, Vector(0,0,1)));
+
+    accel -= this->getAbsDirY();
+    //rotorspeed -= 0.05;
+    //if (rotorspeed <= 0) rotorspeed = 0;
+    //velocityDir.normalize();
+    //rot += Vector(0,0,1);
+    //rotVal -= .4;
+  }
+  else
+  {
+    //if(rotorspeed <= 0.05) rotorspeed += 0.05;
+  }
+
+  velocity += accel*4;
+  //if((this->getAbsDirX()).y <= 0.3 && (this->getAbsDirX()).y >= -0.3) this->shiftDir(Quaternion(rotValZ, Vector(0,0,1)));
+  //if((this->getAbsDirZ()).y <= 0.3 && (this->getAbsDirZ()).y >= -0.3) this->shiftDir(Quaternion(rotValX, Vector(1,0,0)));
+}
+
+
+void Hover::draw() const
+{
+  WorldEntity::draw();
+
+  this->getWeaponManager()->draw();
+}
+
+
+/**
+ * weapon manipulation by the player
+*/
+void Hover::weaponAction()
+{
+  if( this->bFire)
+    {
+      this->getWeaponManager()->fire();
+    }
+}
+
+/**
+ * @todo switch statement ??
+ */
+void Hover::process(const Event &event)
+{
+
+
+  if( event.type == KeyMapper::PEV_LEFT)
+      this->bLeft = event.bPressed;
+  else if( event.type == KeyMapper::PEV_RIGHT)
+      this->bRight = event.bPressed;
+  else if( event.type == KeyMapper::PEV_FIRE1)
+      this->bFire = event.bPressed;
+  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
+    this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
+  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
+    this->getWeaponManager()->previousWeaponConfig();
+  else if( event.type == SDLK_e)
+    this->bAscend = event.bPressed; //this->shiftCoor(0,.1,0);
+  else if( event.type == SDLK_c)
+    this->bDescend = event.bPressed; //this->shiftCoor(0,-.1,0);
+  else if( event.type == KeyMapper::PEV_UP)
+    this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
+  else if( event.type == KeyMapper::PEV_DOWN)
+    this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0);
+  else if( event.type == EV_MOUSE_MOTION)
+  {
+    this->xMouse = event.xRel*mouseSensitivity;
+    this->yMouse = event.yRel*mouseSensitivity;
+  }
+}
+
+#include "weapons/aiming_turret.h"
+// FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG
+void Hover::ADDWEAPON()
+{
+  Weapon* turret = NULL;
+
+  if ((float)rand()/RAND_MAX < .1)
+  {
+    //if (this->getWeaponManager()->hasFreeSlot(2, WTYPE_TURRET))
+    {
+      turret = new Turret();
+      this->addWeapon(turret, 2);
+      this->getWeaponManager()->changeWeaponConfig(2);
+    }
+  }
+  else
+  {
+    //if (this->getWeaponManager()->hasFreeSlot(3))
+    {
+      turret = new AimingTurret();
+      this->addWeapon(turret, 3);
+
+      this->getWeaponManager()->changeWeaponConfig(3);
+    }
+  }
+
+  if(turret != NULL)
+  {
+    turret->setName("Turret");
+    turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);
+  }
+}
Index: trunk/src/world_entities/space_ships/hover.h
===================================================================
--- trunk/src/world_entities/space_ships/hover.h	(revision 6637)
+++ trunk/src/world_entities/space_ships/hover.h	(revision 6637)
@@ -0,0 +1,70 @@
+
+/*!
+ * @file helicopter.h
+ * Implements the Control of a Hover
+ */
+
+#ifndef _HOVER_H
+#define _HOVER_H
+
+#include "playable.h"
+
+
+class Hover : public Playable
+{
+
+  public:
+
+    Hover();
+    Hover(const char* fileName);
+    Hover(const TiXmlElement* root);
+    virtual ~Hover();
+
+    void init();
+    void loadParams(const TiXmlElement* root);
+
+    virtual void enter();
+    virtual void leave();
+
+    virtual void postSpawn();
+    virtual void leftWorld();
+
+    virtual void collidesWith(WorldEntity* entity, const Vector& location);
+    virtual void tick(float time);
+    virtual void draw() const;
+
+    virtual void process(const Event &event);
+
+
+
+  private:
+    void calculateVelocity(float time);
+    void weaponAction();
+
+    // !! temporary !!
+    void ADDWEAPON();
+
+    bool                  bUp;                //!< up button pressed.
+    bool                  bDown;              //!< down button pressed.
+    bool                  bLeft;              //!< left button pressed.
+    bool                  bRight;             //!< right button pressed.
+    bool                  bAscend;            //!< ascend button pressed.
+    bool                  bDescend;           //!< descend button presses.
+    bool                  bFire;              //!< fire button pressed.
+    bool                  bRollL;             //!< rolling button pressed (left)
+    bool                  bRollR;             //!< rolling button pressed (right)
+
+    float                 xMouse;             //!< mouse moved in x-Direction
+    float                 yMouse;             //!< mouse moved in y-Direction
+    float                 mouseSensitivity;   //!< the mouse sensitivity
+
+    Vector                velocity;           //!< the velocity of the player.
+    Vector                velocityDir;        //!< the direction of the velocity of the spaceship
+    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
+    float                 acceleration;       //!< the acceleration of the player.
+    
+    float                 airViscosity;
+
+};
+
+#endif /* _HOVER_H */
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 6634)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 6637)
@@ -132,14 +132,20 @@
   bFire = false;
   xMouse = yMouse = 0;
+  yInvert = 1;
   mouseSensitivity = 0.001;
-  airViscosity = 1.0;
-  cycle = 0.0;
+  airViscosity = 0.01;
+  controlVelocityX = 25;
+  controlVelocityY = 150;
+  shipInertia = 0.5		;
+//  cycle = 0.0;
 
   this->setMaxEnergy(100);
   this->setEnergy(80);
 
-  travelSpeed = 15.0;
-  this->velocity = Vector(0.0,0.0,0.0);
+  travelSpeed = 40.0;
+  acceleration = 3;
+  this->velocity = this->getAbsDirX()*travelSpeed;
   this->mouseDir = this->getAbsDir();
+  this->pitchDir = this->getAbsDir();
 
 //   GLGuiButton* button = new GLGuiPushButton();
@@ -155,15 +161,15 @@
 
   //add events to the eventlist
-  registerEvent(SDLK_w);
-  registerEvent(SDLK_s);
-  registerEvent(SDLK_a);
-  registerEvent(SDLK_d);
-  registerEvent(SDLK_q);
-  registerEvent(SDLK_e);
+  registerEvent(KeyMapper::PEV_UP);
+  registerEvent(KeyMapper::PEV_DOWN);
+  registerEvent(KeyMapper::PEV_LEFT);
+  registerEvent(KeyMapper::PEV_RIGHT);
+  //registerEvent(SDLK_q);
+  //registerEvent(SDLK_e);
   registerEvent(KeyMapper::PEV_FIRE1);
   registerEvent(KeyMapper::PEV_NEXT_WEAPON);
   registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
-  registerEvent(SDLK_PAGEUP);
-  registerEvent(SDLK_PAGEDOWN);
+  //registerEvent(SDLK_PAGEUP);
+  //registerEvent(SDLK_PAGEDOWN);
   registerEvent(EV_MOUSE_MOTION);
 
@@ -279,4 +285,18 @@
   this->weaponAction();
 
+  if( xMouse != 0 || yMouse != 0)
+   {
+    if (xMouse > controlVelocityX) xMouse = controlVelocityX;
+    else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX;
+    if (yMouse > controlVelocityY) yMouse = controlVelocityY;
+    else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY;
+    
+    pitchDir = (Quaternion(xMouse*mouseSensitivity*0.5, Vector(1,0,0)));
+    
+    mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir);
+    xMouse = yMouse = 0;
+   }
+
+
 //   if( this != State::getPlayer()->getControllable())
 //     return;
@@ -285,6 +305,6 @@
   this->calculateVelocity(time);
 
-  Vector move = (velocity)*time;
-
+  Vector move = velocity*time;
+  
   //orient the velocity in the direction of the spaceship.
   travelSpeed = velocity.len();
@@ -293,5 +313,5 @@
 
   //orient the spaceship in direction of the mouse
-   rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, fabsf(time)*3.0);
+   rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, fabsf(time)*shipInertia);
    if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
     this->setAbsDir( rotQuat);
@@ -299,6 +319,11 @@
 
   // this is the air friction (necessary for a smooth control)
-  if(velocity.len() != 0) velocity -= velocity*0.01;
-
+  if(travelSpeed >= 120) velocity -= velocity.getNormalized()*travelSpeed*travelSpeed*0.0001;
+  else if (travelSpeed <= 80) velocity -= velocity.getNormalized()*travelSpeed*0.001;
+  
+  //other physics (gravity)
+  if(travelSpeed < 120)
+  move += Vector(0,-1,0)*60*time + Vector(0,1,0)*travelSpeed/2*time;
+   
   //hoover effect
   //cycle += time;
@@ -306,11 +331,4 @@
 
   //readjust
-
-  /*
-    In the game "Yager" the spaceship gets readjusted when the player moves the mouse.
-    I (bknecht) go and check it out how they do it, we could probably use this also in Orxonox.
-  */
-  //if (xMouse != 0 && yMouse != 0)
-
   //if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
   //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
@@ -318,5 +336,5 @@
   //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
 
-  this->shiftCoor (move);
+  this->shiftCoor(move);
 
 
@@ -337,15 +355,12 @@
   /* calculate the direction in which the craft is heading  */
 
-  Plane plane(Vector(0,1,0), Vector(0,0,0));
+  //Plane plane(Vector(0,1,0), Vector(0,0,0));
 
   if( this->bUp )
    {
      //this->shiftCoor(this->getAbsDirX());
-      accel += (this->getAbsDirX())*2;
-
-      /* Heli-Steuerung
-         accel += (this->getAbsDirX()*2;
-         if(
-      */
+      //accel += (this->getAbsDirX())*2;
+      accel += (this->getAbsDirX())*acceleration;
+
    }
 
@@ -353,5 +368,6 @@
    {
      //this->shiftCoor((this->getAbsDirX())*-1);
-     accel -= (this->getAbsDirX())*2;
+     //accel -= (this->getAbsDirX())*2;
+     accel -= (this->getAbsDirX())*0.5*acceleration;
    }
 
@@ -377,5 +393,5 @@
   if( this->bRollL /* > -this->getRelCoor().z*2*/)
   {
-    mouseDir *= Quaternion(-time, Vector(1,0,0));
+    mouseDir *= Quaternion(-time*2, Vector(1,0,0));
 //    accel -= rightDirection;
     //velocityDir.normalize();
@@ -385,5 +401,5 @@
   if( this->bRollR /* > this->getRelCoor().z*2*/)
   {
-    mouseDir *= Quaternion(time, Vector(1,0,0));
+    mouseDir *= Quaternion(time*2, Vector(1,0,0));
 
     //    accel += rightDirection;
@@ -432,9 +448,7 @@
 void SpaceShip::process(const Event &event)
 {
-
-
-  if( event.type == SDLK_a)
+  if( event.type == KeyMapper::PEV_LEFT)
       this->bRollL = event.bPressed;
-  else if( event.type == SDLK_d)
+  else if( event.type == KeyMapper::PEV_RIGHT)
       this->bRollR = event.bPressed;
   else if( event.type == KeyMapper::PEV_FIRE1)
@@ -446,15 +460,12 @@
   else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
     this->previousWeaponConfig();
-  else if( event.type == SDLK_w)
+  else if( event.type == KeyMapper::PEV_UP)
     this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
-  else if( event.type == SDLK_s)
+  else if( event.type == KeyMapper::PEV_DOWN)
     this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0);
   else if( event.type == EV_MOUSE_MOTION)
   {
-    this->xMouse = event.xRel;
-    this->yMouse = event.yRel;
-    mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
-   // if( xMouse*xMouse + yMouse*yMouse < 0.9)
-     //this->setAbsDir(mouseDir);
+    this->xMouse += event.xRel;
+    this->yMouse += event.yRel;
   }
 }
Index: trunk/src/world_entities/space_ships/space_ship.h
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.h	(revision 6634)
+++ trunk/src/world_entities/space_ships/space_ship.h	(revision 6637)
@@ -65,9 +65,14 @@
     float                 yMouse;             //!< mouse moved in y-Direction
     float                 mouseSensitivity;   //!< the mouse sensitivity
-    float                 cycle;              //!< hovercycle
+    int                   yInvert;
+    int                   controlVelocityX;
+    int                   controlVelocityY;
+//    float                 cycle;              //!< hovercycle
 
     Vector                velocity;           //!< the velocity of the player.
     Quaternion            mouseDir;           //!< the direction where the player wants to fly
+    float                 shipInertia;        //!< the inertia of the ship(how fast the ship reacts to a mouse input)
     Quaternion            rotQuat;
+    Quaternion            pitchDir;
     float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
     float                 acceleration;       //!< the acceleration of the player.
Index: trunk/src/world_entities/weapons/aim.cc
===================================================================
--- trunk/src/world_entities/weapons/aim.cc	(revision 6634)
+++ trunk/src/world_entities/weapons/aim.cc	(revision 6637)
@@ -73,4 +73,6 @@
   this->source = NULL;
 
+  this->range = 0;
+  this->angle = 0;
   this->anim = new tAnimation<Aim>(this, &Aim::setSize);
   this->anim->setInfinity(ANIM_INF_CONSTANT);
@@ -101,13 +103,19 @@
 }
 
-void Aim::searchTarget(float range)
+void Aim::searchTarget()
 {
   std::list<WorldEntity*>::iterator entity;
-
+  Vector diffVec(0.0, 0.0, 0.0);
+  diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() );
+
+//only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
+  if( this == PNode::getNullParent() || diffVec.len() > range  || ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
   for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin();
        entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end();
        entity ++)
   {
-    if (this->source->getAbsCoor().x < (*entity)->getAbsCoor().x && (this->source->getAbsCoor() - (*entity)->getAbsCoor()).len() < range)
+    diffVec = ( (*entity)->getAbsCoor() - this->source->getAbsCoor() );
+
+    if ( diffVec.len() < range  &&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle)
     {
       if (this->getParent() != (*entity))
@@ -119,6 +127,7 @@
     }
   }
-}
-
+//if no target found:
+  this->setParent(PNode::getNullParent());
+}
 
 
@@ -155,6 +164,6 @@
 
 
-  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
-    this->searchTarget(1000);
+//  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
+     this->searchTarget();
 //   float z = 0.0f;
 //   glReadPixels ((int)this->getAbsCoor2D().x,
Index: trunk/src/world_entities/weapons/aim.h
===================================================================
--- trunk/src/world_entities/weapons/aim.h	(revision 6634)
+++ trunk/src/world_entities/weapons/aim.h	(revision 6637)
@@ -38,5 +38,8 @@
   inline PNode* getTarget(PNode* target) { return this->getParent(); };
 
-  void searchTarget(float range);
+  void searchTarget();
+
+  void setRange(float range){this->range = range;};
+  void setAngle(float angle){this->angle = angle;};
 
   void setSize(float size);
@@ -53,4 +56,7 @@
    tAnimation<Aim>* anim;
 
+   float            range;                //!<
+   float            angle;                //!<
+
    PNode*           source;               //!< Where this Shot has come from.
 
Index: trunk/src/world_entities/weapons/aiming_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/aiming_turret.cc	(revision 6634)
+++ trunk/src/world_entities/weapons/aiming_turret.cc	(revision 6637)
@@ -98,4 +98,6 @@
   this->target = new Aim(this);
   this->target->setVisibility(false);
+  this->target->setRange(100);
+  this->target->setAngle(M_PI);
 }
 
@@ -146,5 +148,5 @@
   pj->setAbsDir(this->getAbsDir());
   pj->activate();
-  this->target->searchTarget(100);
+  this->target->searchTarget();
 }
 
Index: trunk/src/world_entities/weapons/targeting_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/targeting_turret.cc	(revision 6634)
+++ trunk/src/world_entities/weapons/targeting_turret.cc	(revision 6637)
@@ -92,5 +92,9 @@
   this->target = new Aim(this);
   this->target->setVisibility(false);
-
+  this->target->setRange(100);
+  this->target->setAngle(M_PI_4/2);
+  this->lockedTime = 0;
+  this->neededLockTime = 2;
+  this->lockedTarget->setParent(PNode::getNullParent());
   this->loadModel("models/guns/turret2.obj");
 
@@ -119,6 +123,17 @@
 void TargetingTurret::tick(float dt)
 {
+  if( lockedTime >= neededLockTime )
+   {
+    lockedTarget = this->target->getParent();
+    lockedTime = 0;
+   }
 
   this->target->tick(dt);
+
+  if(this->target->getParent() == PNode::getNullParent())
+   lockedTime = 0;
+  else
+   lockedTime += dt;
+
 }
 
@@ -137,5 +152,5 @@
   pj->setAbsDir(this->getAbsDir());
   pj->activate();
-  this->target->searchTarget(100);
+  this->target->searchTarget();
 }
 
Index: trunk/src/world_entities/weapons/targeting_turret.h
===================================================================
--- trunk/src/world_entities/weapons/targeting_turret.h	(revision 6634)
+++ trunk/src/world_entities/weapons/targeting_turret.h	(revision 6637)
@@ -32,6 +32,9 @@
 
   private:
-    Aim*          target;
-  };
+    Aim*           target;
+    PNode*         lockedTarget;
+    float          lockedTime;
+    float          neededLockTime;
+  }; 
 
 #endif /* _TARGETING_TURRET_H */
