Index: code/branches/Racingbot/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/branches/Racingbot/src/modules/gametypes/RaceCheckPoint.cc	(revision 9508)
+++ code/branches/Racingbot/src/modules/gametypes/RaceCheckPoint.cc	(revision 9512)
@@ -64,6 +64,4 @@
         myPosition_= this->getPosition(); //eingefuegt
         //orxout(user_status) << "test" << std::endl;
-
-
     }
 
@@ -109,5 +107,5 @@
     //Must not be called before setNextCheckpointsAsVector3 at least once has been called
     void RaceCheckPoint::setNextVirtualCheckpointsAsVector3(const Vector3& checkpoints){
-        std::set<int> lastcheckpoints=this->nextCheckpoints_;
+        /*std::set<int> lastcheckpoints=this->nextCheckpoints_;
         nextCheckpoints_.clear();
         std::set<int>::iterator it = lastcheckpoints.begin();
@@ -116,5 +114,6 @@
             it++;
         }
-        this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); // the red number has the type double and for the cast (to int) is added 0.5 so that the cast works correctly
+        if(checkpoints.x!=-1)
+            this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); // the red number has the type double and for the cast (to int) is added 0.5 so that the cast works correctly
 
         if(checkpoints.y<-1){
@@ -122,5 +121,6 @@
                     it++;
         }
-        this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
+        if(checkpoints.y!=-1)
+            this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
 
         if(checkpoints.z<-1){
@@ -128,5 +128,13 @@
                     it++;
         }
-        this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));
+        if(checkpoints.z!=-1)
+            this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));*/
+        nextCheckpointsVirtual_.clear();
+        if(checkpoints.x!=-1)
+            nextCheckpointsVirtual_.insert(checkpoints.x);
+        if(checkpoints.y!=-1)
+                nextCheckpointsVirtual_.insert(checkpoints.y);
+        if(checkpoints.z!=-1)
+                nextCheckpointsVirtual_.insert(checkpoints.z);
     }
 
@@ -141,4 +149,6 @@
         if (checkpoints.z > -1)
         this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));
+
+        this->nextCheckpointsVirtual_=nextCheckpoints_;
     }
 
@@ -175,5 +185,16 @@
     Vector3 RaceCheckPoint::getNextCheckpointsAsVector3()
     {
-        Vector3 checkpoints = getVirtualNextCheckpointsAsVector3();
+        Vector3 checkpoints(-1,-1,-1); int count=0;
+        for (std::set<int>::iterator it= nextCheckpoints_.begin();it!=nextCheckpoints_.end(); it++ ){
+            switch (count)
+                        {
+                            case 0: checkpoints.x = static_cast<Ogre::Real>(*it); break;
+                            case 1: checkpoints.y = static_cast<Ogre::Real>(*it); break;
+                            case 2: checkpoints.z = static_cast<Ogre::Real>(*it); break;
+                        }
+                        ++count;
+        }
+        return checkpoints;
+        //= getVirtualNextCheckpointsAsVector3();
         int j[3];
         j[0]=changeVirtualToRealCheckPoint(checkpoints.x);
@@ -201,5 +222,5 @@
 
         size_t count = 0;
-        for (std::set<int>::iterator it = this->nextCheckpoints_.begin(); it != this->nextCheckpoints_.end(); ++it)
+        for (std::set<int>::iterator it = this->nextCheckpointsVirtual_.begin(); it != this->nextCheckpointsVirtual_.end(); ++it)
         {
             switch (count)
Index: code/branches/Racingbot/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/branches/Racingbot/src/modules/gametypes/RaceCheckPoint.h	(revision 9508)
+++ code/branches/Racingbot/src/modules/gametypes/RaceCheckPoint.h	(revision 9512)
@@ -67,8 +67,10 @@
             const std::set<int>& getVirtualNextCheckpoints() const
             {
-                return this->nextCheckpoints_;
+                return this->nextCheckpointsVirtual_;
             }
-            std::set<int> getNextCheckpoints()
+
+            const std::set<int>& getNextCheckpoints()
             {
+                return nextCheckpoints_;
                 std::set<int> temp;
                 std::set<int> temp2=getVirtualNextCheckpoints();
@@ -119,4 +121,5 @@
             std::vector<PlayerInfo*> players_; ///< The player that reached the checkpoint
             Vector3 myPosition_;
+            std::set<int>  nextCheckpointsVirtual_;
             std::map<int,int> virtualToRealCheckPoints_; // if virtualChepoint was inserted the original can be reconstructed
     };
Index: code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.cc
===================================================================
--- code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.cc	(revision 9508)
+++ code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.cc	(revision 9512)
@@ -54,6 +54,6 @@
         ArtificialController(creator)
     {
-        RegisterObject(SpaceRaceController);
-        std::vector<RaceCheckPoint*> checkpoints;
+        RegisterObject(SpaceRaceController)
+;        std::vector<RaceCheckPoint*> checkpoints;
 
         virtualCheckPointIndex=-2;
@@ -66,17 +66,57 @@
         OrxAssert(!checkpoints.empty(), "No Checkpoints in Level");
         checkpoints_=checkpoints;
+        orxout()<<"es gibt: "<<checkpoints_.size()<<"checkpoints"<<endl;
+        for(std::vector<RaceCheckPoint*>::iterator it=checkpoints_.begin(); it!=checkpoints_.end(); it++)
+        {
+            orxout()<<"Checkpoint "<<(*it)->getCheckpointIndex()<<"; NExtReal: ";
+            std::set<int> temp =(*it)->getNextCheckpoints();
+            for (std::set<int>::iterator ii =temp.begin(); ii!=temp.end(); ii++)
+            {
+                orxout()<<(*ii)<<", ";
+            }
+
+            orxout()<<" NextVirtual: ";
+            temp=(*it)->getVirtualNextCheckpoints();
+            for (std::set<int>::iterator ii =temp.begin(); ii!=temp.end(); ii++)
+            {
+                orxout()<<(*ii)<<", ";
+            }
+            orxout()<<endl<<endl;
+
+        }//ausgabe
 
         for( std::vector<RaceCheckPoint*>::iterator it = checkpoints.begin(); it!=checkpoints.end(); ++it)
         {
             std::set<int> nextCheckPoints = ((*it)->getNextCheckpoints());
-            if(!nextCheckPoints.empty()) {
-                for (std::set<int>::iterator numb = nextCheckPoints.begin(); numb!=nextCheckPoints.end(); numb++) {
+            if(!nextCheckPoints.empty())
+            {
+                for (std::set<int>::iterator numb = nextCheckPoints.begin(); numb!=nextCheckPoints.end(); numb++)
+                {
                     RaceCheckPoint* point2 = findCheckpoint((*numb));
 
                     if(point2 != NULL)
-                        placeVirtualCheckpoints((*it), point2);
+                    placeVirtualCheckpoints((*it), point2);
                 }
             }
         }
+        for(std::vector<RaceCheckPoint*>::iterator it=checkpoints_.begin(); it!=checkpoints_.end(); it++)
+        {
+            orxout()<<"Checkpoint "<<(*it)->getCheckpointIndex()<<"; NExtReal: ";
+            std::set<int> temp =(*it)->getNextCheckpoints();
+            for (std::set<int>::iterator ii =temp.begin(); ii!=temp.end(); ii++)
+            {
+                orxout()<<(*ii)<<", ";
+            }
+
+            orxout()<<" NextVirtual: ";
+            temp=(*it)->getVirtualNextCheckpoints();
+            for (std::set<int>::iterator ii =temp.begin(); ii!=temp.end(); ii++)
+            {
+                orxout()<<(*ii)<<", ";
+            }
+            orxout()<<endl;
+
+        }//ausgabe
+        orxout()<<"es gibt: "<<checkpoints_.size()<<"checkpoints"<<endl;
         staticRacePoints_ = findStaticCheckpoints(checkpoints);
         // initialisation of currentRaceCheckpoint_
@@ -84,5 +124,6 @@
 
         int i;
-        for (i=-2; findCheckpoint(i)!= NULL; i--){
+        for (i=-2; findCheckpoint(i)!= NULL; i--)
+        {
             continue;
         }
@@ -147,9 +188,11 @@
             for (std::set<int>::iterator it = currentCheckpoint->getVirtualNextCheckpoints().begin(); it!= currentCheckpoint->getVirtualNextCheckpoints().end(); ++it)
             {
-                if(currentCheckpoint==findCheckpoint(*it)){
+                if(currentCheckpoint==findCheckpoint(*it))
+                {
                     orxout() << currentCheckpoint->getCheckpointIndex()<<endl;
                     continue;
                 }
-               numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(*it), zaehler);
+                if(findCheckpoint(*it)==NULL){orxout()<<"Problematic Point: "<<(*it)<<endl;}
+                numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(*it), zaehler);
             }
             (*zaehler)[currentCheckpoint] += numberOfWays;
@@ -266,5 +309,6 @@
     {
         RaceCheckPoint* newTempRaceCheckPoint;
-        for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it!= ObjectList<SpaceRaceManager>::end(); ++it){
+        for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it!= ObjectList<SpaceRaceManager>::end(); ++it)
+        {
             newTempRaceCheckPoint = new RaceCheckPoint((*it));
         }
@@ -276,4 +320,5 @@
 
         Vector3 temp = previousCheckpoint->getVirtualNextCheckpointsAsVector3();
+        orxout()<<"temp bei 0: ="<< temp.x<< temp.y<< temp.z<<endl;
         checkpoints_.insert(checkpoints_.end(), newTempRaceCheckPoint);
         int positionInNextCheckPoint;
@@ -281,5 +326,5 @@
         {
             if(previousCheckpoint->getVirtualNextCheckpointsAsVector3()[i] == indexFollowingCheckPoint)
-                positionInNextCheckPoint=i;
+            positionInNextCheckPoint=i;
         }
         switch(positionInNextCheckPoint)
@@ -291,9 +336,11 @@
         previousCheckpoint->setNextVirtualCheckpointsAsVector3(temp); //Existiert internes Problem bei negativen index fueer next Checkpoint
         virtualCheckPointIndex--;
+        orxout()<<"temp bei 1: ="<< temp.x<< temp.y<< temp.z<<endl;
+        orxout()<<"temp nach ausgabe: "<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().x<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().y<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().z<<endl;
         //OrxAssert(virtualCheckPointIndex < -1, "TO much virtual cp");
         /*orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<", following:"<<indexFollowingCheckPoint<<" :       "<<temp.x<<", "<<temp.y<<", "<<temp.z<<";       ";
-        temp=previousCheckpoint->getNextCheckpointsAsVector3();
-        orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<":       "<<temp.x<<", "<<temp.y<<", "<<temp.z<<";       ";
-        orxout()<<endl;*/
+         temp=previousCheckpoint->getNextCheckpointsAsVector3();
+         orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<":       "<<temp.x<<", "<<temp.y<<", "<<temp.z<<";       ";
+         orxout()<<endl;*/
         return newTempRaceCheckPoint;
     }
@@ -339,4 +386,5 @@
 
         // Abmessung fuer MINDISTANCE gut;
+
         else if((lastPositionSpaceship-this->getControllableEntity()->getPosition()).length()/dt< MINDISTANCE )
         {
@@ -363,5 +411,6 @@
     }
 
-    bool SpaceRaceController::directLinePossible(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2,std::vector<StaticEntity*> allObjects){
+    bool SpaceRaceController::directLinePossible(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2,std::vector<StaticEntity*> allObjects)
+    {
 
         Vector3 cP1ToCP2=(racepoint2->getPosition()-racepoint1->getPosition()) / (racepoint2->getPosition()-racepoint1->getPosition()).length(); //unit Vector
@@ -370,13 +419,16 @@
         btScalar radiusObject;
 
-        for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it!=allObjects.end(); ++it){
-            for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++){
+        for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it!=allObjects.end(); ++it)
+        {
+            for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
+            {
                 btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
                 if(currentShape == NULL)
-                    continue;
+                continue;
 
                 currentShape->getBoundingSphere(positionObject,radiusObject);
                 Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
-                if((powf((cP1ToCP2.dotProduct(centerCP1-positionObjectNonBT)),2)-(centerCP1-positionObjectNonBT).dotProduct(centerCP1-positionObjectNonBT)+powf(radiusObject, 2))>0){
+                if((powf((cP1ToCP2.dotProduct(centerCP1-positionObjectNonBT)),2)-(centerCP1-positionObjectNonBT).dotProduct(centerCP1-positionObjectNonBT)+powf(radiusObject, 2))>0)
+                {
                     return false;
                 }
@@ -388,40 +440,42 @@
     }
 
-    void SpaceRaceController::computeVirtualCheckpoint(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2,std::vector<StaticEntity*> allObjects){
-                Vector3 cP1ToCP2=(racepoint2->getPosition()-racepoint1->getPosition()) / (racepoint2->getPosition()-racepoint1->getPosition()).length(); //unit Vector
-                Vector3 centerCP1=racepoint1->getPosition();
-                btVector3 positionObject;
-                btScalar radiusObject;
-
-                for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it!=allObjects.end(); ++it){
-                    for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++){
-                        btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
-                        if(currentShape == NULL)
-                            continue;
-
-                        currentShape->getBoundingSphere(positionObject,radiusObject);
-                        Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
-                        if((powf((cP1ToCP2.dotProduct(centerCP1-positionObjectNonBT)),2)-(centerCP1-positionObjectNonBT).dotProduct(centerCP1-positionObjectNonBT)+powf(radiusObject, 2))>0){
-                            Vector3 zufall;
-                            Vector3 objectmiddle=positionObjectNonBT;
-                            do{
-                                      zufall=Vector3(rnd(),rnd(),rnd());//random
-                            }while((zufall.crossProduct(objectmiddle-racepoint1->getPosition())).length()==0);
-
-
-                            Vector3 normalvec=zufall.crossProduct(objectmiddle-racepoint1->getPosition());
-                            // a'/b'=a/b => a' =b'*a/b
-                            float laengeNormalvec=(objectmiddle-racepoint1->getPosition()).length()/sqrt((objectmiddle-racepoint1->getPosition()).squaredLength()-radiusObject*radiusObject)*radiusObject;
-                            RaceCheckPoint* newVirtualCheckpoint=addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), objectmiddle+normalvec/normalvec.length()*laengeNormalvec);
-                            //placeVirtualCheckpoints(newVirtualCheckpoint, racepoint2);
-                            return;
-                        }
-
-                    }
+    void SpaceRaceController::computeVirtualCheckpoint(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2,std::vector<StaticEntity*> allObjects)
+    {
+        Vector3 cP1ToCP2=(racepoint2->getPosition()-racepoint1->getPosition()) / (racepoint2->getPosition()-racepoint1->getPosition()).length(); //unit Vector
+        Vector3 centerCP1=racepoint1->getPosition();
+        btVector3 positionObject;
+        btScalar radiusObject;
+
+        for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it!=allObjects.end(); ++it)
+        {
+            for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
+            {
+                btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
+                if(currentShape == NULL)
+                continue;
+
+                currentShape->getBoundingSphere(positionObject,radiusObject);
+                Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
+                if((powf((cP1ToCP2.dotProduct(centerCP1-positionObjectNonBT)),2)-(centerCP1-positionObjectNonBT).dotProduct(centerCP1-positionObjectNonBT)+powf(radiusObject, 2))>0)
+                {
+                    Vector3 zufall;
+                    Vector3 objectmiddle=positionObjectNonBT;
+                    do
+                    {
+                        zufall=Vector3(rnd(),rnd(),rnd());//random
+                    }while((zufall.crossProduct(objectmiddle-racepoint1->getPosition())).length()==0);
+
+                    Vector3 normalvec=zufall.crossProduct(objectmiddle-racepoint1->getPosition());
+                    // a'/b'=a/b => a' =b'*a/b
+                    float laengeNormalvec=(objectmiddle-racepoint1->getPosition()).length()/sqrt((objectmiddle-racepoint1->getPosition()).squaredLength()-radiusObject*radiusObject)*radiusObject;
+                    RaceCheckPoint* newVirtualCheckpoint=addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), objectmiddle+normalvec/normalvec.length()*laengeNormalvec);
+                    //placeVirtualCheckpoints(newVirtualCheckpoint, racepoint2);
+                    return;
                 }
 
-    }
-
-
+            }
+        }
+
+    }
 
     void SpaceRaceController::placeVirtualCheckpoints(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2)
@@ -441,95 +495,96 @@
         }
 
-        if(!directLinePossible(racepoint1, racepoint2, problematicObjects)) {
+        if(!directLinePossible(racepoint1, racepoint2, problematicObjects))
+        {
+            orxout()<<"From "<<racepoint1->getCheckpointIndex()<<" to "<<racepoint2->getCheckpointIndex()<<"produces: "<< virtualCheckPointIndex<<endl;
             computeVirtualCheckpoint(racepoint1, racepoint2, problematicObjects);
         }
 
-
-//
-//        do{
-//            zufall=Vector3(rnd(),rnd(),rnd());//random
-//        }while((zufall.crossProduct(objectmiddle-racepoint1->getPosition())).length()==0);
-//
-//        Vector3 normalvec=zufall.crossProduct(objectmiddle-racepoint1->getPosition());
-//        // a'/b'=a/b => a' =b'*a/b
-//        float laengeNormalvec=(objectmiddle-racepoint1->getPosition()).length()/sqrt((objectmiddle-racepoint1->getPosition()).squaredLength()-radius*radius)*radius;
-//        addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), objectmiddle+normalvec/normalvec.length()*laengeNormalvec);
-
-//        Vector3 richtungen [6];
-//        richtungen[0]= Vector3(1,0,0);
-//        richtungen[1]= Vector3(-1,0,0);
-//        richtungen[2]= Vector3(0,1,0);
-//        richtungen[3]= Vector3(0,-1,0);
-//        richtungen[4]= Vector3(0,0,1);
-//        richtungen[5]= Vector3(0,0,-1);
-//
-//        for (int i = 0; i< 6; i++)
-//        {
-//            const int STEPS=100;
-//            const float PHI=1.1;
-//            bool collision=false;
-//
-//            for (int j =0; j<STEPS; j++)
-//            {
-//                Vector3 tempPosition=(point1 - (point2-point1+richtungen[i]*PHI)*(float)j/STEPS);
-//                for (std::vector<StaticEntity*>::iterator it = problematicObjects.begin(); it!=problematicObjects.end(); ++it)
-//                {
-//                    btVector3 positionObject;
-//                    btScalar radiusObject;
-//                    if((*it)==NULL)
-//                    {   orxout()<<"Problempoint 1.1"<<endl; continue;}
-//                    //TODO: Probably it points on a wrong object
-//                    for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
-//                    {
-//                        if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==NULL)
-//                        {    continue;}
-//
-//                        orxout()<<"Problempoint 2.1"<<endl;
-//                        (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
-//                        Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
-//                        if (((tempPosition - positionObjectNonBT).length()<radiusObject) && (vergleicheQuader((tempPosition-positionObjectNonBT),(*it)->getScale3D())))
-//                        {
-//                            collision=true; break;
-//                        }
-//                    }
-//                    if(collision) break;
-//                }
-//                if(collision)break;
-//            }
-//            if(collision) continue;
-//            // no collision => possible Way
-//            for (float j =0; j<STEPS; j++)
-//            {
-//                Vector3 possiblePosition=(point1 - (point2-point1+richtungen[i]*PHI)*j/STEPS);
-//                collision=false;
-//                for(int ij=0; ij<STEPS; j++)
-//                {
-//                    Vector3 tempPosition=(possiblePosition - (point2-possiblePosition)*(float)ij/STEPS);
-//                    for (std::vector<StaticEntity*>::iterator it = problematicObjects.begin(); it!=problematicObjects.end(); ++it)
-//                    {
-//                        btVector3 positionObject;
-//                        btScalar radiusObject;
-//                        if((*it)==NULL)
-//                        {   orxout()<<"Problempoint 1"<<endl; continue;}
-//                        for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
-//                        {
-//                            if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==NULL)
-//                            {   orxout()<<"Problempoint 2.2"<<endl; continue;}
-//                            (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
-//                            Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
-//                            if (((tempPosition-positionObjectNonBT).length()<radiusObject) && (vergleicheQuader((tempPosition-positionObjectNonBT),(*it)->getScale3D())))
-//                            {
-//                                collision=true; break;
-//                            }
-//                        }
-//                        if(collision) break;
-//                    }
-//                    if(collision)break;
-//                    //addVirtualCheckPoint(racepoint1, racepoint2->getCheckpointIndex(), possiblePosition);
-//                    return;
-//                }
-//
-//            }
-//        }
+        //
+        //        do{
+        //            zufall=Vector3(rnd(),rnd(),rnd());//random
+        //        }while((zufall.crossProduct(objectmiddle-racepoint1->getPosition())).length()==0);
+        //
+        //        Vector3 normalvec=zufall.crossProduct(objectmiddle-racepoint1->getPosition());
+        //        // a'/b'=a/b => a' =b'*a/b
+        //        float laengeNormalvec=(objectmiddle-racepoint1->getPosition()).length()/sqrt((objectmiddle-racepoint1->getPosition()).squaredLength()-radius*radius)*radius;
+        //        addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), objectmiddle+normalvec/normalvec.length()*laengeNormalvec);
+
+        //        Vector3 richtungen [6];
+        //        richtungen[0]= Vector3(1,0,0);
+        //        richtungen[1]= Vector3(-1,0,0);
+        //        richtungen[2]= Vector3(0,1,0);
+        //        richtungen[3]= Vector3(0,-1,0);
+        //        richtungen[4]= Vector3(0,0,1);
+        //        richtungen[5]= Vector3(0,0,-1);
+        //
+        //        for (int i = 0; i< 6; i++)
+        //        {
+        //            const int STEPS=100;
+        //            const float PHI=1.1;
+        //            bool collision=false;
+        //
+        //            for (int j =0; j<STEPS; j++)
+        //            {
+        //                Vector3 tempPosition=(point1 - (point2-point1+richtungen[i]*PHI)*(float)j/STEPS);
+        //                for (std::vector<StaticEntity*>::iterator it = problematicObjects.begin(); it!=problematicObjects.end(); ++it)
+        //                {
+        //                    btVector3 positionObject;
+        //                    btScalar radiusObject;
+        //                    if((*it)==NULL)
+        //                    {   orxout()<<"Problempoint 1.1"<<endl; continue;}
+        //                    //TODO: Probably it points on a wrong object
+        //                    for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
+        //                    {
+        //                        if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==NULL)
+        //                        {    continue;}
+        //
+        //                        orxout()<<"Problempoint 2.1"<<endl;
+        //                        (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
+        //                        Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
+        //                        if (((tempPosition - positionObjectNonBT).length()<radiusObject) && (vergleicheQuader((tempPosition-positionObjectNonBT),(*it)->getScale3D())))
+        //                        {
+        //                            collision=true; break;
+        //                        }
+        //                    }
+        //                    if(collision) break;
+        //                }
+        //                if(collision)break;
+        //            }
+        //            if(collision) continue;
+        //            // no collision => possible Way
+        //            for (float j =0; j<STEPS; j++)
+        //            {
+        //                Vector3 possiblePosition=(point1 - (point2-point1+richtungen[i]*PHI)*j/STEPS);
+        //                collision=false;
+        //                for(int ij=0; ij<STEPS; j++)
+        //                {
+        //                    Vector3 tempPosition=(possiblePosition - (point2-possiblePosition)*(float)ij/STEPS);
+        //                    for (std::vector<StaticEntity*>::iterator it = problematicObjects.begin(); it!=problematicObjects.end(); ++it)
+        //                    {
+        //                        btVector3 positionObject;
+        //                        btScalar radiusObject;
+        //                        if((*it)==NULL)
+        //                        {   orxout()<<"Problempoint 1"<<endl; continue;}
+        //                        for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
+        //                        {
+        //                            if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==NULL)
+        //                            {   orxout()<<"Problempoint 2.2"<<endl; continue;}
+        //                            (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
+        //                            Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
+        //                            if (((tempPosition-positionObjectNonBT).length()<radiusObject) && (vergleicheQuader((tempPosition-positionObjectNonBT),(*it)->getScale3D())))
+        //                            {
+        //                                collision=true; break;
+        //                            }
+        //                        }
+        //                        if(collision) break;
+        //                    }
+        //                    if(collision)break;
+        //                    //addVirtualCheckPoint(racepoint1, racepoint2->getCheckpointIndex(), possiblePosition);
+        //                    return;
+        //                }
+        //
+        //            }
+        //        }
 
     }
