Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceController.cc @ 11306

Last change on this file since 11306 was 11306, checked in by meilel, 7 years ago

nada

  • Property svn:eol-style set to native
File size: 24.6 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have     a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *  Created on: Oct 8, 2012
23 *      Author: purgham
24 */
25
26#include <gametypes/SpaceRaceController.h>
27#include "core/CoreIncludes.h"
28#include "core/XMLPort.h"
29#include "gametypes/SpaceRaceManager.h"
30#include "collisionshapes/CollisionShape.h"
31#include "BulletCollision/CollisionShapes/btCollisionShape.h"
32
33
34namespace orxonox
35{
36    RegisterClass(SpaceRaceController);
37
38    const int ADJUSTDISTANCE = 500;
39    const int MINDISTANCE = 5;
40    /*
41     * Idea: Find static Point (checkpoints the spaceship has to reach)
42     */
43    SpaceRaceController::SpaceRaceController(Context* context) :
44        ArtificialController(context)
45    {
46        RegisterObject(SpaceRaceController);
47        std::vector<RaceCheckPoint*> checkpoints;
48
49        virtualCheckPointIndex = -2;
50        if (ObjectList<SpaceRaceManager>().size() != 1)
51            orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>().size() << endl;
52        for (SpaceRaceManager* manager : ObjectList<SpaceRaceManager>())
53        {
54            checkpoints = manager->getAllCheckpoints();
55            nextRaceCheckpoint_ = manager->findCheckpoint(0);
56        }
57
58        OrxAssert(!checkpoints.empty(), "No Checkpoints in Level");
59        checkpoints_ = checkpoints;
60        staticRacePoints_ = findStaticCheckpoints(nextRaceCheckpoint_, checkpoints);
61        // initialisation of currentRaceCheckpoint_
62        currentRaceCheckpoint_ = nullptr;
63
64        int i;
65        for (i = -2; findCheckpoint(i) != nullptr; i--)
66        {
67            continue;
68        }
69
70    }
71
72    //------------------------------
73    // functions for initialisation
74
75    void SpaceRaceController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
76    {
77        SUPER(SpaceRaceController, XMLPort, xmlelement, mode);
78        XMLPortParam(ArtificialController, "accuracy", setAccuracy, getAccuracy, xmlelement, mode).defaultValues(100.0f);
79        XMLPortObject(ArtificialController, WorldEntity, "waypoints", addWaypoint, getWaypoint, xmlelement, mode);
80    }
81
82    /*
83     * called from constructor 'SpaceRaceController'
84     * returns a vector of static Point (checkpoints the spaceship has to reach)
85     */
86    std::vector<RaceCheckPoint*> SpaceRaceController::findStaticCheckpoints(RaceCheckPoint* currentCheckpoint, const std::vector<RaceCheckPoint*>& allCheckpoints)
87    {
88        std::map<RaceCheckPoint*, int> zaehler; // counts how many times the checkpoint was reached (for simulation)
89        for (RaceCheckPoint* checkpoint : allCheckpoints)
90        {
91            zaehler.insert(std::pair<RaceCheckPoint*, int>(checkpoint,0));
92        }
93        int maxWays = rekSimulationCheckpointsReached(currentCheckpoint, zaehler);
94
95        std::vector<RaceCheckPoint*> returnVec;
96        for (const auto& mapEntry : zaehler)
97        {
98            if (mapEntry.second == maxWays)
99            {
100                returnVec.push_back(mapEntry.first);
101            }
102        }
103        return returnVec;
104    }
105
106    /*
107     * called from 'findStaticCheckpoints'
108     * return how many ways go from the given Checkpoint to the last Checkpoint (of the Game)
109     */
110    int SpaceRaceController::rekSimulationCheckpointsReached(RaceCheckPoint* currentCheckpoint, std::map<RaceCheckPoint*, int>& zaehler)
111    {
112
113        if (currentCheckpoint->isLast())
114        {// last point reached
115
116            zaehler[currentCheckpoint] += 1;
117            return 1; // 1 Way form the last point to this one
118        }
119        else
120        {
121            int numberOfWays = 0; // counts number of ways from this Point to the last point
122            for (int checkpointIndex : currentCheckpoint->getNextCheckpoints())
123            {
124                if (currentCheckpoint == findCheckpoint(checkpointIndex))
125                {
126                    //orxout() << currentCheckpoint->getCheckpointIndex()<<endl;
127                    continue;
128                }
129                if (findCheckpoint(checkpointIndex) == nullptr)
130                    orxout(internal_warning) << "Problematic Point: " << checkpointIndex << endl;
131                else
132                    numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(checkpointIndex), zaehler);
133            }
134            zaehler[currentCheckpoint] += numberOfWays;
135            return numberOfWays; // returns the number of ways from this point to the last one
136        }
137    }
138
139    //-------------------------------------
140    // functions for dynamic Way-search
141
142    float SpaceRaceController::distanceSpaceshipToCheckPoint(RaceCheckPoint* CheckPoint)
143    {
144        if (this->getControllableEntity() != nullptr)
145        {
146            return (CheckPoint->getPosition()- this->getControllableEntity()->getPosition()).length();
147        }
148        return -1;
149    }
150
151    /*
152     * called by: 'tick' or  'adjustNextPoint'
153     * returns the next Checkpoint which the shortest way contains
154     */
155    RaceCheckPoint* SpaceRaceController::nextPointFind(RaceCheckPoint* raceCheckpoint)
156    {
157        float minDistance = 0;
158        RaceCheckPoint* minNextRaceCheckPoint = nullptr;
159
160        // find the next checkpoint with the minimal distance
161        for (int checkpointIndex : raceCheckpoint->getNextCheckpoints())
162        {
163            RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(checkpointIndex);
164            float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition());
165
166            if (distance < minDistance || minNextRaceCheckPoint == nullptr)
167            {
168                minDistance = distance;
169                minNextRaceCheckPoint = nextRaceCheckPoint;
170            }
171        }
172
173        return minNextRaceCheckPoint;
174    }
175
176    /*
177     * called from 'nextPointFind'
178     * returns the distance between "currentPosition" and the next static checkpoint that can be reached from "currentCheckPoint"
179     */
180    float SpaceRaceController::recCalculateDistance(RaceCheckPoint* currentCheckPoint, const Vector3& currentPosition)
181    {
182        // find: looks if the currentCheckPoint is a staticCheckPoint (staticCheckPoint is the same as: static Point)
183        if (std::find(staticRacePoints_.begin(), staticRacePoints_.end(), currentCheckPoint) != staticRacePoints_.end())
184        {
185            return (currentCheckPoint->getPosition() - currentPosition).length();
186        }
187        else
188        {
189            float minimum = std::numeric_limits<float>::max();
190            for (int checkpointIndex : currentCheckPoint->getNextCheckpoints())
191            {
192                int dist_currentCheckPoint_currentPosition = static_cast<int> ((currentPosition- currentCheckPoint->getPosition()).length());
193
194                minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint(checkpointIndex), currentCheckPoint->getPosition()));
195                // minimum of distanz from 'currentPosition' to the next static Checkpoint
196            }
197            return minimum;
198        }
199    }
200
201    /*called by 'tick'
202     *adjust chosen way of the Spaceship every "AdjustDistance" because spaceship could be displaced through an other one
203     */
204    RaceCheckPoint* SpaceRaceController::adjustNextPoint()
205    {
206        if (currentRaceCheckpoint_ == nullptr) // no Adjust possible
207
208        {
209            return nextRaceCheckpoint_;
210        }
211        if ((currentRaceCheckpoint_->getNextCheckpoints()).size() == 1) // no Adjust possible
212
213        {
214            return nextRaceCheckpoint_;
215        }
216
217        //Adjust possible
218
219        return nextPointFind(currentRaceCheckpoint_);
220    }
221
222    RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const
223    {
224        for (RaceCheckPoint* checkpoint : this->checkpoints_)
225            if (checkpoint->getCheckpointIndex() == index)
226                return checkpoint;
227        return nullptr;
228    }
229
230    /*RaceCheckPoint* SpaceRaceController::addVirtualCheckPoint( RaceCheckPoint* previousCheckpoint, int indexFollowingCheckPoint , const Vector3& virtualCheckPointPosition )
231    {
232        orxout()<<"add VCP at"<<virtualCheckPointPosition.x<<", "<<virtualCheckPointPosition.y<<", "<<virtualCheckPointPosition.z<<endl;
233        RaceCheckPoint* newTempRaceCheckPoint;
234        ObjectList<SpaceRaceManager> list;
235        for (ObjectList<SpaceRaceManager>::iterator it = list.begin(); it!= list.end(); ++it)
236        {
237            newTempRaceCheckPoint = new RaceCheckPoint((*it));
238        }
239        newTempRaceCheckPoint->setVisible(false);
240        newTempRaceCheckPoint->setPosition(virtualCheckPointPosition);
241        newTempRaceCheckPoint->setCheckpointIndex(virtualCheckPointIndex);
242        newTempRaceCheckPoint->setLast(false);
243        newTempRaceCheckPoint->setNextVirtualCheckpointsAsVector3(Vector3(indexFollowingCheckPoint,-1,-1));
244
245        Vector3 temp = previousCheckpoint->getVirtualNextCheckpointsAsVector3();
246        //orxout()<<"temp bei 0: ="<< temp.x<< temp.y<< temp.z<<endl;
247        checkpoints_.insert(checkpoints_.end(), newTempRaceCheckPoint);
248        int positionInNextCheckPoint;
249        for (int i = 0; i <3; i++)
250        {
251            if(previousCheckpoint->getVirtualNextCheckpointsAsVector3()[i] == indexFollowingCheckPoint)
252            positionInNextCheckPoint=i;
253        }
254        switch(positionInNextCheckPoint)
255        {
256            case 0: temp.x=virtualCheckPointIndex; break;
257            case 1: temp.y=virtualCheckPointIndex; break;
258            case 2: temp.z=virtualCheckPointIndex; break;
259        }
260        previousCheckpoint->setNextVirtualCheckpointsAsVector3(temp); //Existiert internes Problem bei negativen index fueer next Checkpoint
261        virtualCheckPointIndex--;
262        //orxout()<<"temp bei 1: ="<< temp.x<< temp.y<< temp.z<<endl;
263        //orxout()<<"temp nach ausgabe: "<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().x<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().y<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().z<<endl;
264        //OrxAssert(virtualCheckPointIndex < -1, "TO much virtual cp");
265        orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<", following:"<<indexFollowingCheckPoint<<" :       "<<temp.x<<", "<<temp.y<<", "<<temp.z<<";       ";
266         temp=previousCheckpoint->getNextCheckpointsAsVector3();
267         orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<":       "<<temp.x<<", "<<temp.y<<", "<<temp.z<<";       ";
268         orxout()<<endl;
269        return newTempRaceCheckPoint;
270    }*/
271
272    SpaceRaceController::~SpaceRaceController()
273    {
274        if (this->isInitialized())
275        {
276            for (int i =-1; i>virtualCheckPointIndex; i--)
277                delete findCheckpoint(i);
278        }
279    }
280
281    void SpaceRaceController::tick(float dt)
282    {
283        if (this->getControllableEntity() == nullptr || this->getControllableEntity()->getPlayer() == nullptr )
284        {
285            //orxout()<< this->getControllableEntity() << " in tick"<<endl;
286            return;
287        }
288        //FOR virtual Checkpoints
289        if(nextRaceCheckpoint_->getCheckpointIndex() < 0)
290        {
291            if( distanceSpaceshipToCheckPoint(nextRaceCheckpoint_) < 200)
292            {
293                currentRaceCheckpoint_=nextRaceCheckpoint_;
294                nextRaceCheckpoint_ = nextPointFind(nextRaceCheckpoint_);
295                lastPositionSpaceship=this->getControllableEntity()->getPosition();
296                //orxout()<< "CP "<< currentRaceCheckpoint_->getCheckpointIndex()<<" chanched to: "<< nextRaceCheckpoint_->getCheckpointIndex()<<endl;
297            }
298        }
299
300        if (nextRaceCheckpoint_->playerWasHere(this->getControllableEntity()->getPlayer()))
301        {//Checkpoint erreicht
302
303            currentRaceCheckpoint_ = nextRaceCheckpoint_;
304            OrxAssert(nextRaceCheckpoint_, "next race checkpoint undefined");
305            nextRaceCheckpoint_ = nextPointFind(nextRaceCheckpoint_);
306            lastPositionSpaceship = this->getControllableEntity()->getPosition();
307            //orxout()<< "CP "<< currentRaceCheckpoint_->getCheckpointIndex()<<" chanched to: "<< nextRaceCheckpoint_->getCheckpointIndex()<<endl;
308        }
309        else if ((lastPositionSpaceship-this->getControllableEntity()->getPosition()).length()/dt > ADJUSTDISTANCE)
310        {
311            nextRaceCheckpoint_ = adjustNextPoint();
312            lastPositionSpaceship = this->getControllableEntity()->getPosition();
313        }
314
315        // Abmessung fuer MINDISTANCE gut;
316
317        else if((lastPositionSpaceship - this->getControllableEntity()->getPosition()).length()/dt < MINDISTANCE )
318        {
319            this->moveToPosition(Vector3(rnd()*100, rnd()*100, rnd()*100));
320            this->spin();
321            //orxout(user_status) << "Mindistance reached" << std::endl;
322            return;
323        }
324        //orxout(user_status) << "dt= " << dt << ";  distance= " << (lastPositionSpaceship-this->getControllableEntity()->getPosition()).length() <<std::endl;
325        lastPositionSpaceship = this->getControllableEntity()->getPosition();
326       
327this->boostControl();
328        this->moveToPosition(nextRaceCheckpoint_->getPosition());
329        this->boostControl();
330    }
331
332    // True if a coordinate of 'pointToPoint' is smaller then the corresponding coordinate of 'groesse'
333    bool SpaceRaceController::vergleicheQuader(const Vector3& pointToPoint, const Vector3& groesse)
334    {
335        if(std::abs(pointToPoint.x) < groesse.x)
336            return true;
337        if(std::abs(pointToPoint.y) < groesse.y)
338            return true;
339        if(std::abs(pointToPoint.z) < groesse.z)
340            return true;
341        return false;
342
343    }
344
345    bool SpaceRaceController::directLinePossible(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2, const std::vector<StaticEntity*>& allObjects)
346    {
347
348        Vector3 cP1ToCP2 = (racepoint2->getPosition() - racepoint1->getPosition()) / (racepoint2->getPosition() - racepoint1->getPosition()).length(); //unit Vector
349        Vector3 centerCP1 = racepoint1->getPosition();
350        btVector3 positionObject;
351        btScalar radiusObject;
352
353        for (StaticEntity* object : allObjects)
354        {
355            for (int everyShape=0; object->getAttachedCollisionShape(everyShape) != nullptr; everyShape++)
356            {
357                btCollisionShape* currentShape = object->getAttachedCollisionShape(everyShape)->getCollisionShape();
358                if(currentShape == nullptr)
359                continue;
360
361                currentShape->getBoundingSphere(positionObject,radiusObject);
362                Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
363                if((powf((cP1ToCP2.dotProduct(centerCP1-positionObjectNonBT)),2)-(centerCP1-positionObjectNonBT).dotProduct(centerCP1-positionObjectNonBT)+powf(radiusObject, 2))>0)
364                {
365                    return false;
366                }
367
368            }
369        }
370        return true;
371
372    }
373/*
374    void SpaceRaceController::useBoost()
375    {
376
377    }
378*/
379
380    /*void SpaceRaceController::computeVirtualCheckpoint(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2, const std::vector<StaticEntity*>& allObjects)
381    {
382        Vector3 cP1ToCP2=(racepoint2->getPosition()-racepoint1->getPosition()) / (racepoint2->getPosition()-racepoint1->getPosition()).length(); //unit Vector
383        Vector3 centerCP1=racepoint1->getPosition();
384        btVector3 positionObject;
385        btScalar radiusObject;
386
387        for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it != allObjects.end(); ++it)
388        {
389            for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++)
390            {
391                btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
392                if(currentShape == nullptr)
393                continue;
394
395                currentShape->getBoundingSphere(positionObject,radiusObject);
396                Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
397                Vector3 norm_r_CP = cP1ToCP2.crossProduct(centerCP1-positionObjectNonBT);
398
399                if(norm_r_CP.length() == 0){
400                    Vector3 zufall;
401                    do{
402                        zufall=Vector3(rnd(),rnd(),rnd());//random
403                    }while((zufall.crossProduct(cP1ToCP2)).length() == 0);
404                    norm_r_CP=zufall.crossProduct(cP1ToCP2);
405                }
406                Vector3 VecToVCP = norm_r_CP.crossProduct(cP1ToCP2);
407                float distanzToCP1 = sqrt(powf(radiusObject,4)/(powf((centerCP1-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
408                float distanzToCP2 = sqrt(powf(radiusObject,4)/(powf((racepoint2->getPosition()-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
409                float distanz = std::max(distanzToCP1,distanzToCP2);
410                //float distanz = 0.0f; //TEMPORARY
411                Vector3 newCheckpointPositionPos = positionObjectNonBT+(distanz*VecToVCP)/VecToVCP.length();
412                Vector3 newCheckpointPositionNeg = positionObjectNonBT-(distanz*VecToVCP)/VecToVCP.length();
413                if((newCheckpointPositionPos - centerCP1).length() + (newCheckpointPositionPos - (centerCP1+cP1ToCP2)).length() < (newCheckpointPositionNeg - centerCP1).length() + (newCheckpointPositionNeg - (centerCP1+cP1ToCP2)).length() )
414                {
415                    RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionPos);
416                }
417                else
418                {
419                    RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionNeg);
420                }
421                return;
422            }
423        }
424
425    }*/
426
427    /*void SpaceRaceController::placeVirtualCheckpoints(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2)
428    {
429        Vector3 point1 = racepoint1->getPosition();
430        Vector3 point2 = racepoint2->getPosition();
431        std::vector<StaticEntity*> problematicObjects;
432
433        ObjectList<StaticEntity> list;
434        for (ObjectList<StaticEntity>::iterator it = list.begin(); it!= list.end(); ++it)
435        {
436
437            if (dynamic_cast<RaceCheckPoint*>(*it) != nullptr)
438            {
439                continue;
440            } // does not work jet
441
442            problematicObjects.insert(problematicObjects.end(), *it);
443            //it->getScale3D();// vector fuer halbe wuerfellaenge
444        }
445
446        if(!directLinePossible(racepoint1, racepoint2, problematicObjects))
447        {
448            //orxout()<<"From "<<racepoint1->getCheckpointIndex()<<" to "<<racepoint2->getCheckpointIndex()<<"produces: "<< virtualCheckPointIndex<<endl;
449            computeVirtualCheckpoint(racepoint1, racepoint2, problematicObjects);
450        }
451
452        //
453        //        do{
454        //            zufall=Vector3(rnd(),rnd(),rnd());//random
455        //        }while((zufall.crossProduct(objectmiddle-racepoint1->getPosition())).length()==0);
456        //
457        //        Vector3 normalvec=zufall.crossProduct(objectmiddle-racepoint1->getPosition());
458        //        // a'/b'=a/b => a' =b'*a/b
459        //        float laengeNormalvec=(objectmiddle-racepoint1->getPosition()).length()/sqrt((objectmiddle-racepoint1->getPosition()).squaredLength()-radius*radius)*radius;
460        //        addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), objectmiddle+normalvec/normalvec.length()*laengeNormalvec);
461
462        //        Vector3 richtungen [6];
463        //        richtungen[0]= Vector3(1,0,0);
464        //        richtungen[1]= Vector3(-1,0,0);
465        //        richtungen[2]= Vector3(0,1,0);
466        //        richtungen[3]= Vector3(0,-1,0);
467        //        richtungen[4]= Vector3(0,0,1);
468        //        richtungen[5]= Vector3(0,0,-1);
469        //
470        //        for (int i = 0; i< 6; i++)
471        //        {
472        //            const int STEPS=100;
473        //            const float PHI=1.1;
474        //            bool collision=false;
475        //
476        //            for (int j =0; j<STEPS; j++)
477        //            {
478        //                Vector3 tempPosition=(point1 - (point2-point1+richtungen[i]*PHI)*(float)j/STEPS);
479        //                for (std::vector<StaticEntity*>::iterator it = problematicObjects.begin(); it!=problematicObjects.end(); ++it)
480        //                {
481        //                    btVector3 positionObject;
482        //                    btScalar radiusObject;
483        //                    if((*it)==nullptr)
484        //                    {   orxout()<<"Problempoint 1.1"<<endl; continue;}
485        //                    //TODO: Probably it points on a wrong object
486        //                    for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=nullptr; everyShape++)
487        //                    {
488        //                        if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==nullptr)
489        //                        {    continue;}
490        //
491        //                        orxout()<<"Problempoint 2.1"<<endl;
492        //                        (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
493        //                        Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
494        //                        if (((tempPosition - positionObjectNonBT).length()<radiusObject) && (vergleicheQuader((tempPosition-positionObjectNonBT),(*it)->getScale3D())))
495        //                        {
496        //                            collision=true; break;
497        //                        }
498        //                    }
499        //                    if(collision) break;
500        //                }
501        //                if(collision)break;
502        //            }
503        //            if(collision) continue;
504        //            // no collision => possible Way
505        //            for (float j =0; j<STEPS; j++)
506        //            {
507        //                Vector3 possiblePosition=(point1 - (point2-point1+richtungen[i]*PHI)*j/STEPS);
508        //                collision=false;
509        //                for(int ij=0; ij<STEPS; j++)
510        //                {
511        //                    Vector3 tempPosition=(possiblePosition - (point2-possiblePosition)*(float)ij/STEPS);
512        //                    for (std::vector<StaticEntity*>::iterator it = problematicObjects.begin(); it!=problematicObjects.end(); ++it)
513        //                    {
514        //                        btVector3 positionObject;
515        //                        btScalar radiusObject;
516        //                        if((*it)==nullptr)
517        //                        {   orxout()<<"Problempoint 1"<<endl; continue;}
518        //                        for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=nullptr; everyShape++)
519        //                        {
520        //                            if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==nullptr)
521        //                            {   orxout()<<"Problempoint 2.2"<<endl; continue;}
522        //                            (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
523        //                            Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
524        //                            if (((tempPosition-positionObjectNonBT).length()<radiusObject) && (vergleicheQuader((tempPosition-positionObjectNonBT),(*it)->getScale3D())))
525        //                            {
526        //                                collision=true; break;
527        //                            }
528        //                        }
529        //                        if(collision) break;
530        //                    }
531        //                    if(collision)break;
532        //                    //addVirtualCheckPoint(racepoint1, racepoint2->getCheckpointIndex(), possiblePosition);
533        //                    return;
534        //                }
535        //
536        //            }
537        //        }
538
539    }*/
540}
Note: See TracBrowser for help on using the repository browser.