Index: code/branches/3DPacman_FS18/src/modules/Pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/Pacman/PacmanGhost.cc	(revision 11849)
+++ code/branches/3DPacman_FS18/src/modules/Pacman/PacmanGhost.cc	(revision 11859)
@@ -46,7 +46,4 @@
         RegisterObject(PacmanGhost);
 
-        this->localLinearAcceleration_.setValue(1, 1, 1);
-        this->localAngularAcceleration_.setValue(1, 1, 1);
-
         this->velocity = Vector3(0, 0, 0);
 
@@ -79,7 +76,4 @@
         SUPER(PacmanGhost, XMLPort, xmlelement, mode);
 
-        XMLPortParam(PacmanGhost, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
-        XMLPortParam(PacmanGhost, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
-        XMLPortParam(PacmanGhost, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
         XMLPortParam(PacmanGhost, "resetposition", setResetPosition, getResetPosition, xmlelement, mode);
     }
@@ -87,5 +81,5 @@
 
     
-    Vector3 possibleposition[] = {Vector3(0,10,245),Vector3(215,0,240)};
+    Vector3 possibleposition[] = {Vector3(0,10,245),Vector3(215,10,245),Vector3(215,10,220)};
 
     /**
@@ -99,22 +93,10 @@
         SUPER(PacmanGhost, tick, dt);
 
-        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxiliaryThrust_);
-        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxiliaryThrust_);
-        if (this->localLinearAcceleration_.z() > 0)
-            this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxiliaryThrust_);
-        else
-            this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
-        this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
-        this->localLinearAcceleration_.setValue(0, 0, 0);
-
-        this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
-        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
-        this->localAngularAcceleration_.setValue(0, 0, 0);
-
+        //setorientation
 
         this->actuelposition = this->getPosition();
         
         //Stop, if target arrived
-        if(((this->actuelposition.x - this->target_x)<0.1) && ((this->actuelposition.z - this->target_z)<0.1)){
+        if((abs(this->actuelposition.x - this->target_x)<0.1) && (abs(this->actuelposition.z - this->target_z)<0.1)){
                  this->ismoving = false;
         }
@@ -122,10 +104,10 @@
         //Move, if ghost hasn't arrived yet
         if(this->ismoving){
-            if(!((this->actuelposition.z-target_z)<0.1)) {
-                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),-sgn(this->actuelposition.y),-sgn(this->actuelposition.z-this->target_z));
+            if(!(abs(this->actuelposition.z-target_z)<0.1)) {
+                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,-sgn(this->actuelposition.z-this->target_z));
                 move(dt, actuelposition, velocity);
             }    
-            if(!((this->actuelposition.x-target_x)<0.1)){
-                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),-sgn(this->actuelposition.y),-sgn(this->actuelposition.z-this->target_z));
+            if(!(abs(this->actuelposition.x-target_x)<0.1)){
+                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,-sgn(this->actuelposition.z-this->target_z));
                 move(dt, actuelposition, velocity);
             }
@@ -134,14 +116,40 @@
         //Check on which position ghost has arrived and set new target
          else{
-            if(((this->actuelposition.x - possibleposition[0].x)<0.1) && ((this->actuelposition.z - possibleposition[0].z)<0.1)){
-                this->target_x = possibleposition[1].x;
-                this->target_z = possibleposition[1].z; 
-                this->ismoving = true;
+            if((abs(this->actuelposition.x - possibleposition[0].x)<0.1) && (abs(this->actuelposition.z - possibleposition[0].z)<0.1)){
+                decision = rand()%1;
+            switch(decision){
+                case 0:
+                    this->target_x = possibleposition[1].x;
+                    this->target_z = possibleposition[1].z; 
+                    this->ismoving = true;
             }
-            else if(((actuelposition.x - possibleposition[1].x)<0.1) && ((actuelposition.z - possibleposition[1].z)<0.1)){
-                this->target_x = possibleposition[0].x;
-                this->target_z = possibleposition[0].z; 
-                this->ismoving = true;
+            
             }
+            else if((abs(actuelposition.x - possibleposition[1].x)<0.1) && (abs(actuelposition.z - possibleposition[1].z)<0.1)){
+                decision = rand()%2;
+            switch(decision){
+                case 0:
+                    this->target_x = possibleposition[0].x;
+                    this->target_z = possibleposition[0].z; 
+                    this->ismoving = true;
+                    break;
+                case 1:
+                    this->target_x = possibleposition[2].x;
+                    this->target_z = possibleposition[2].z; 
+                    this->ismoving = true;    
+            }
+
+            }
+            if((abs(this->actuelposition.x - possibleposition[2].x)<0.1) && (abs(this->actuelposition.z - possibleposition[2].z)<0.1)){
+                decision = rand()%1;
+            switch(decision){
+                case 0:
+                    this->target_x = possibleposition[1].x;
+                    this->target_z = possibleposition[1].z; 
+                    this->ismoving = true;
+            }
+            
+            }
+
             else{
             } //End of Position table
@@ -151,76 +159,10 @@
 
 
-
     void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
-
-        this->setPosition(Vector3(actuelposition.x+velocity.x*dt,actuelposition.y+velocity.y*dt ,actuelposition.z+velocity.z*dt));
+        this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt));
     }
 
-
-    /**
-    @brief
-        Moves the AutonomousDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
-    @param value
-        The vector determining the amount of the movement.
-    */
-    void PacmanGhost::moveFrontBack(const Vector2& value)
-    {
-        //this->setPosition(dt*(actuelposition + velocity_));
+    void PacmanGhost::resetGhost(){
+        this->setPosition(resetposition);
     }
-
-    /**
-    @brief
-        Moves the AutonomousDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
-    @param value
-        The vector determining the amount of the movement.
-    */
-    void PacmanGhost::moveRightLeft(const Vector2& value)
-    {
-        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
-    }
-
-    /**
-    @brief
-        Moves the AutonomousDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
-    @param value
-        The vector determining the amount of the movement.
-    */
-    void PacmanGhost::moveUpDown(const Vector2& value)
-    {
-        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
-    }
-
-    /**
-    @brief
-        Rotates the AutonomousDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
-    @param value
-        The vector determining the amount of the angular movement.
-    */
-    void PacmanGhost::rotateYaw(const Vector2& value)
-    {
-        this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
-    }
-
-    /**
-    @brief
-        Rotates the AutonomousDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
-    @param value
-        The vector determining the amount of the angular movement.
-    */
-    void PacmanGhost::rotatePitch(const Vector2& value)
-    {
-        this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
-    }
-
-    /**
-    @brief
-        Rotates the AutonomousDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
-    @param value
-        The vector determining the amount of the angular movement.
-    */
-    void PacmanGhost::rotateRoll(const Vector2& value)
-    {
-        this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
-    }
-
 }
