Index: /branches/playability/src/world_entities/space_ships/space_ship.cc
===================================================================
--- /branches/playability/src/world_entities/space_ships/space_ship.cc	(revision 10018)
+++ /branches/playability/src/world_entities/space_ships/space_ship.cc	(revision 10019)
@@ -90,7 +90,7 @@
  */
 SpaceShip::SpaceShip(const std::string& fileName)
-    : secWeaponMan(this),
-    supportedPlaymodes(Playable::Vertical) ,
-    playmode(Playable::Vertical)
+    : secWeaponMan(this) //,
+    //supportedPlaymodes(Playable::Vertical) ,
+    //playmode(Playable::Vertical)
 {
   this->init();
@@ -113,7 +113,7 @@
 */
 SpaceShip::SpaceShip(const TiXmlElement* root)
-    : secWeaponMan(this),
-    supportedPlaymodes(Playable::Vertical) ,
-    playmode(Playable::Vertical)
+    : secWeaponMan(this) //,
+    //supportedPlaymodes(Playable::Vertical) ,
+    //playmode(Playable::Vertical)
 {
   this->init();
@@ -129,4 +129,6 @@
 void SpaceShip::init()
 {
+
+  this->setSupportedPlaymodes(Playable::Vertical);
 
   //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
@@ -231,9 +233,4 @@
   this->cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
 
-  this->travelSpeed = 0.0;
-  this->cameraLook = 0.0f;
-  this->acceleration = 20.0f;
-  //this->airFriction = 0.0f;
-  this->cameraSpeed = 0.0;
   /*
   this->velocity = this->getAbsDirX()*travelSpeed;
@@ -366,9 +363,12 @@
   registerVar( new SynchronizeableVector( &velocity, &velocity, "velocity", PERMISSION_MASTER_SERVER ) );
 
-  this->enterPlaymode(Playable::Vertical);
   //this->airFriction = 0.5f;
-  this->travelDistance = Vector2D(50.0, 50.0);
-  this->travelSpeed = 50;
+  this->travelDistancePlus = Vector2D(38.0, 43.0);
+  this->travelDistanceMinus = Vector2D(-38.0, -43.0);
+  this->travelSpeed = 80;
   this->cameraSpeed = 40;
+  this->cameraLook = 0.0f;
+  this->acceleration = 120.0f;
+  //this->airFriction = 0.0f;
 
   this->travelNode->debugDraw();
@@ -404,5 +404,5 @@
 */
 
-
+/*
 void SpaceShip::setTravelDistance(const Vector2D& distance)
 {
@@ -414,4 +414,5 @@
   this->setTravelDistance(Vector2D(x, y));
 }
+*/
 
 
@@ -432,5 +433,7 @@
   this->secWeaponMan.showCrosshair();
   //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true);
-  this->attachCamera();
+  if (!this->setPlaymode(Playable::Vertical))
+    std::cout << "playmode not supported";
+  //this->attachCamera();
 }
 
@@ -439,5 +442,5 @@
   this->secWeaponMan.hideCrosshair();
   //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false);
-  this->detachCamera();
+  //this->detachCamera();
 }
 
@@ -786,11 +789,10 @@
 
         State::getCameraNode()->setParentSoft(this->travelNode);
-        State::getCameraNode()->setRelCoorSoft(0, 40,0);
+        State::getCameraNode()->setRelCoorSoft(-0.01, 40,0);
         State::getCameraTargetNode()->setParentSoft(this->travelNode);
-        State::getCameraTargetNode()->setRelCoorSoft(5,0,0);
+        State::getCameraTargetNode()->setRelCoorSoft(0,0,0);
 
         this->debugNode(1);
         this->travelNode->debugNode(1);
-        std::cout << "testprint";
       }
       break;
@@ -799,4 +801,5 @@
       PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName());
   }
+  std::cout << Playable::playmodeToString(this->getPlaymode());
 }
 
@@ -808,28 +811,56 @@
 void SpaceShip::movement (float dt)
 {
-    // these routines will change the travel movement into zero in a short amout of time, if the player
-    // doesn't press any buttons.
-    if (this->velocity.x >= 0)
-    {
-      if (this->velocity.x > 2*this->acceleration * dt)
-        this->velocity.x -= 2* this->acceleration * dt;
-      else
-        this->velocity.x = 0;
-    }
-    else
-    {
-      if (this->velocity.x < -2*this->acceleration * dt)
-        this->velocity.x += 2* this->acceleration * dt;
-      else
-        this->velocity.x = 0;
-    }
+  //by releasing the buttons, the velocity decreases with airCoeff*Acceleration. Should be strong enough so 
+  //the ship doesn't slide too much. 
+  float airCoeff = 2.5;
+
+  float pi = 3.14;
+
+  // these routines will change the travel movement into zero in a short amout of time, if the player
+  // doesn't press any buttons.
+  if (this->velocity.x >= 0)
+  {
+    if (this->velocity.x > airCoeff*this->acceleration * dt)
+      this->velocity.x -= airCoeff* this->acceleration * dt;
+    else
+      this->velocity.x = 0;
+  }
+  else
+  {
+    if (this->velocity.x < -airCoeff*this->acceleration * dt)
+      this->velocity.x += airCoeff* this->acceleration * dt;
+    else
+      this->velocity.x = 0;
+  }
+  if (this->velocity.z >= 0)
+  {
+    if (this->velocity.z > airCoeff*this->acceleration * dt)
+      this->velocity.z -= airCoeff* this->acceleration * dt;
+    else
+      this->velocity.z = 0;
+  }
+  else
+  {
+    if (this->velocity.z < -airCoeff*this->acceleration * dt)
+      this->velocity.z += airCoeff* this->acceleration * dt;
+    else
+      this->velocity.z = 0;
+  }
+
+  // this will evite, that the ship moves outside the travelDistance- borders,when the player releases all buttons
+  // and its continuing to slide a bit.
+  Vector oldCoor = this->getRelCoor();
+  if (this->getRelCoor().x > this->travelDistancePlus.x) this->setRelCoor(this->travelDistancePlus.x, oldCoor.y, oldCoor.z);
+  if (this->getRelCoor().x < this->travelDistanceMinus.x) this->setRelCoor(this->travelDistanceMinus.x, oldCoor.y, oldCoor.z);
+  if (this->getRelCoor().z > this->travelDistancePlus.y) this->setRelCoor(oldCoor.x, oldCoor.y, this->travelDistancePlus.y);
+  if (this->getRelCoor().z < this->travelDistanceMinus.y) this->setRelCoor(oldCoor.x, oldCoor.y, this->travelDistanceMinus.y);
 
   if( this->bForward )
   {
-    if(this->getRelCoor().x < this->travelDistance.x)
+    if(this->getRelCoor().x < this->travelDistancePlus.x)
     {
       if (this->velocity.x < this->travelSpeed)
       {
-        this->velocity.x += 3*this->acceleration*dt;
+        this->velocity.x += (airCoeff + 1.0)*this->acceleration*dt;
       }
       else
@@ -846,9 +877,9 @@
   if( this->bBackward )
   {
-    if(this->getRelCoor().x > -this->travelDistance.x)
+    if(this->getRelCoor().x > this->travelDistanceMinus.x)
     {
       if (this->velocity.x > -this->travelSpeed)
       {
-        this->velocity.x -= 3*this->acceleration*dt;
+        this->velocity.x -= (airCoeff + 1.0)*this->acceleration*dt;
       }
       else
@@ -862,94 +893,60 @@
     }
   }
+
   if( this->bLeft)
   {
+    if(this->getRelCoor().z > this->travelDistanceMinus.y)
+    {
+      if (this->velocity.z > -this->travelSpeed)
+      {
+        this->velocity.z -= (airCoeff + 1.0)*this->acceleration*dt;
+      }
+      else
+      {
+        this->velocity.z = -this->travelSpeed;
+      }
+    }
+    else
+    {
+      this->velocity.z = 0.0f;
+    }
   }
 
   if( this->bRight)
   {
-  }
-
+    if(this->getRelCoor().z < this->travelDistancePlus.y)
+    {
+      if (this->velocity.z < this->travelSpeed)
+      {
+        this->velocity.z += (airCoeff + 1.0)*this->acceleration*dt;
+      }
+      else
+      {
+        this->velocity.z = this->travelSpeed;
+      }
+    }
+    else
+    {
+      this->velocity.z = 0.0f;
+    }
+  }
+  
+  this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0));
+  this->shiftCoor (this->velocity * dt);
+  
+  float angle = this->velocity.z / travelSpeed * pi / 3;
+  if (angle > pi/3) angle = pi/3;
+  if (angle < -pi/3) angle = -pi/3;
+  this->setRelDirSoft(Quaternion(angle, Vector(1,0,0)), 5.0f);
+
+  /*
   switch(this->getPlaymode())
   {
-    case Playable::Full3D:
-    /*
-      {
-        Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
-
-        // this is the air friction (necessary for a smooth control)
-        Vector damping = (this->velocity * this->airFriction);
-
-
-        this->velocity += (accelerationDir - damping)* dt;
-        this->shiftCoor (this->velocity * dt);
-
-        // limit the maximum rotation speed.
-        if (this->rotation != 0.0f)
-        {
-          float maxRot = 10.0 * dt;
-          if (unlikely(this->rotation > maxRot)) this->rotation = maxRot;
-          if (unlikely(this->rotation < -maxRot)) this->rotation = -maxRot;
-          this->direction *= Quaternion(-M_PI/4.0*this->rotation, Vector(0,1,0));
-
-          this->rotation = 0.0f;
-        }
-
-        this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
-      }
+    case Playable::Vertical:
       break;
-    */
-    case Playable::Vertical:
-      {
-        /*
-        if (this->toTravelHeight != NULL)
-        {
-          this->travelNode->shiftCoor(Vector(0, (*toTravelHeight - this->travelNode->getAbsCoor().y) * dt * 10.0, 0));
-          if (fabsf(this->travelNode->getAbsCoor().y - *this->toTravelHeight) < .1)
-          {
-            delete this->toTravelHeight;
-            this->toTravelHeight = NULL;
-          }
-        }
-        */
-        this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0));
-
-        /*
-        accel.y = 0.0;
-
-        Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
-        accelerationDir.y = 0.0;
-
-        // this is the air friction (necessary for a smooth control)
-        Vector damping = (this->velocity * this->airFriction);
-
-
-        this->velocity += (accelerationDir - damping)* dt;
-
-        if (this->getRelCoor().z > this->travelDistance.y && velocity.z > 0.0)
-          this->velocity.z = 0.0f;
-        if (this->getRelCoor().z < -this->travelDistance.y && velocity.z < 0.0)
-          this->velocity.z = 0.0f;
-
-        if (this->getRelCoor().x > this->travelDistance.x && velocity.x > 0.0)
-          this->velocity.x = 0.0f;
-        if (this->getRelCoor().x < -this->travelDistance.x && velocity.x < 0.0)
-          this->velocity.x = 0.0f;
-
-        */
-        this->shiftCoor (this->velocity * dt);
-   
-
-        /*
-        if (accel.z == 0)
-          this->setRelDirSoft(Quaternion(0, Vector(0,0,0)), 5.0f);
-        else
-          this->setRelDirSoft(Quaternion(this->velocity.z * 5, Vector(1,0,0)), 4.5f);
-        */
-      }
-      break;
-
     default:
       PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName());
   }
-}
-
+  */
+}
+
Index: /branches/playability/src/world_entities/space_ships/space_ship.h
===================================================================
--- /branches/playability/src/world_entities/space_ships/space_ship.h	(revision 10018)
+++ /branches/playability/src/world_entities/space_ships/space_ship.h	(revision 10019)
@@ -31,7 +31,9 @@
     virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f);
     void setTravelSpeed(float travelSpeed);
+    /*
     void setTravelHeight(float travelHeight);
     void setTravelDistance(const Vector2D& distance);
     void setTravelDistance(float x, float y);
+    */
 
     //void setAirFriction(float friction) { this->airFriction = friction; };
@@ -150,5 +152,6 @@
     PNode*                travelNode;
     float                 travelSpeed;        //!< the current speed of the Ship (to make soft movement)
-    Vector2D              travelDistance;     //!< Travel-Distance away from the TravelNode
+    Vector2D              travelDistancePlus;     //!< Travel-Distance away from the TravelNode
+    Vector2D              travelDistanceMinus;
 
 // Camera
