Index: /code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
===================================================================
--- /code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2313)
+++ /code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2314)
@@ -81,4 +81,10 @@
         XMLPortParam(SpaceShip, "rotacc",            setRotAcc,            getRotAcc,            xmlelement, mode);
         XMLPortParam(SpaceShip, "transdamp",         setTransDamp,         getTransDamp,         xmlelement, mode);
+
+        if (this->physicalBody_)
+        {
+            this->physicalBody_->setDamping(0.8, 0.9);
+            this->physicalBody_->setActivationState(DISABLE_DEACTIVATION);
+        }
     }
 
@@ -106,39 +112,39 @@
             // #####################################
 
-            Vector3 velocity = this->getVelocity();
-            if (velocity.x > this->maxSecondarySpeed_)
-                velocity.x = this->maxSecondarySpeed_;
-            if (velocity.x < -this->maxSecondarySpeed_)
-                velocity.x = -this->maxSecondarySpeed_;
-            if (velocity.y > this->maxSecondarySpeed_)
-                velocity.y = this->maxSecondarySpeed_;
-            if (velocity.y < -this->maxSecondarySpeed_)
-                velocity.y = -this->maxSecondarySpeed_;
-            if (velocity.z > this->maxSecondarySpeed_)
-                velocity.z = this->maxSecondarySpeed_;
-            if (velocity.z < -this->maxSpeed_)
-                velocity.z = -this->maxSpeed_;
+            //Vector3 velocity = this->getVelocity();
+            //if (velocity.x > this->maxSecondarySpeed_)
+            //    velocity.x = this->maxSecondarySpeed_;
+            //if (velocity.x < -this->maxSecondarySpeed_)
+            //    velocity.x = -this->maxSecondarySpeed_;
+            //if (velocity.y > this->maxSecondarySpeed_)
+            //    velocity.y = this->maxSecondarySpeed_;
+            //if (velocity.y < -this->maxSecondarySpeed_)
+            //    velocity.y = -this->maxSecondarySpeed_;
+            //if (velocity.z > this->maxSecondarySpeed_)
+            //    velocity.z = this->maxSecondarySpeed_;
+            //if (velocity.z < -this->maxSpeed_)
+            //    velocity.z = -this->maxSpeed_;
 
             // normalize velocity and acceleration
-            for (size_t dimension = 0; dimension < 3; ++dimension)
-            {
-                if (this->acceleration_[dimension] == 0)
-                {
-                    if (velocity[dimension] > 0)
-                    {
-                        velocity[dimension] -= (this->translationDamping_ * dt);
-                        if (velocity[dimension] < 0)
-                            velocity[dimension] = 0;
-                    }
-                    else if (velocity[dimension] < 0)
-                    {
-                        velocity[dimension] += (this->translationDamping_ * dt);
-                        if (velocity[dimension] > 0)
-                            velocity[dimension] = 0;
-                    }
-                }
-            }
-
-            this->setVelocity(velocity);
+            //for (size_t dimension = 0; dimension < 3; ++dimension)
+            //{
+            //    if (this->acceleration_[dimension] == 0)
+            //    {
+            //        if (velocity[dimension] > 0)
+            //        {
+            //            velocity[dimension] -= (this->translationDamping_ * dt);
+            //            if (velocity[dimension] < 0)
+            //                velocity[dimension] = 0;
+            //        }
+            //        else if (velocity[dimension] < 0)
+            //        {
+            //            velocity[dimension] += (this->translationDamping_ * dt);
+            //            if (velocity[dimension] > 0)
+            //                velocity[dimension] = 0;
+            //        }
+            //    }
+            //}
+
+            //this->setVelocity(velocity);
         }
 
@@ -147,21 +153,21 @@
 
 
-        if (this->isLocallyControlled())
-        {
-            this->yaw(this->yawRotation_ * dt);
-            if (this->bInvertYAxis_)
-                this->pitch(Degree(-this->pitchRotation_ * dt));
-            else
-                this->pitch(Degree( this->pitchRotation_ * dt));
-            this->roll(this->rollRotation_ * dt);
-
-            this->acceleration_.x = 0;
-            this->acceleration_.y = 0;
-            this->acceleration_.z = 0;
-
-            this->yawRotation_   = this->zeroDegree_;
-            this->pitchRotation_ = this->zeroDegree_;
-            this->rollRotation_  = this->zeroDegree_;
-        }
+        //if (this->isLocallyControlled())
+        //{
+        //    this->yaw(this->yawRotation_ * dt);
+        //    if (this->bInvertYAxis_)
+        //        this->pitch(Degree(-this->pitchRotation_ * dt));
+        //    else
+        //        this->pitch(Degree( this->pitchRotation_ * dt));
+        //    this->roll(this->rollRotation_ * dt);
+
+        //    this->acceleration_.x = 0;
+        //    this->acceleration_.y = 0;
+        //    this->acceleration_.z = 0;
+
+        //    this->yawRotation_   = this->zeroDegree_;
+        //    this->pitchRotation_ = this->zeroDegree_;
+        //    this->rollRotation_  = this->zeroDegree_;
+        //}
     }
 
@@ -169,5 +175,5 @@
     {
         assert(this->physicalBody_);
-        this->physicalBody_->applyCentralForce(btVector3(0.0f, 0.0f, -1.0f/this->physicalBody_->getInvMass() * value.x));
+        this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, 0.0f, -getMass() * value.x * 100));
 //        this->acceleration_.z = -this->translationAcceleration_ * value.x;
     }
@@ -175,5 +181,5 @@
     void SpaceShip::moveRightLeft(const Vector2& value)
     {
-        this->physicalBody_->applyCentralForce(btVector3(1.0f/this->physicalBody_->getInvMass() * value.x, 0.0f, 0.0f));
+        this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * btVector3(getMass() * value.x * 100, 0.0f, 0.0f));
 //        this->acceleration_.x = this->translationAcceleration_ * value.x;
     }
@@ -181,5 +187,5 @@
     void SpaceShip::moveUpDown(const Vector2& value)
     {
-        this->physicalBody_->applyCentralForce(btVector3(0.0f, 1.0f/this->physicalBody_->getInvMass() * value.x, 0.0f));
+        this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, getMass() * value.x * 100, 0.0f));
 //        this->acceleration_.y = this->translationAcceleration_ * value.x;
     }
@@ -187,30 +193,33 @@
     void SpaceShip::rotateYaw(const Vector2& value)
     {
-        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        if (temp > this->maxRotation_)
-            temp = this->maxRotation_;
-        if (temp < -this->maxRotation_)
-            temp = -this->maxRotation_;
-        this->yawRotation_ = Degree(temp);
+        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, getMass() * value.x * 10000, 0.0f));
+        //Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
+        //if (temp > this->maxRotation_)
+        //    temp = this->maxRotation_;
+        //if (temp < -this->maxRotation_)
+        //    temp = -this->maxRotation_;
+        //this->yawRotation_ = Degree(temp);
     }
 
     void SpaceShip::rotatePitch(const Vector2& value)
     {
-        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        if (temp > this->maxRotation_)
-            temp = this->maxRotation_;
-        if (temp < -this->maxRotation_)
-            temp = -this->maxRotation_;
-        this->pitchRotation_ = Degree(temp);
+        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(getMass() * value.x * 10000, 0.0f, 0.0f));
+        //Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
+        //if (temp > this->maxRotation_)
+        //    temp = this->maxRotation_;
+        //if (temp < -this->maxRotation_)
+        //    temp = -this->maxRotation_;
+        //this->pitchRotation_ = Degree(temp);
     }
 
     void SpaceShip::rotateRoll(const Vector2& value)
     {
-        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        if (temp > this->maxRotation_)
-            temp = this->maxRotation_;
-        if (temp < -this->maxRotation_)
-            temp = -this->maxRotation_;
-        this->rollRotation_ = Degree(temp);
+        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, 0.0f, -getMass() * value.x * 10000));
+        //Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
+        //if (temp > this->maxRotation_)
+        //    temp = this->maxRotation_;
+        //if (temp < -this->maxRotation_)
+        //    temp = -this->maxRotation_;
+        //this->rollRotation_ = Degree(temp);
     }
 
