src/PhysicsObject.cc
changeset 211 d5d52fb191e4
parent 210 501b5a1918b5
child 221 fbc5db6fce45
equal deleted inserted replaced
210:501b5a1918b5 211:d5d52fb191e4
   201 //        reached += unitVector;
   201 //        reached += unitVector;
   202     }
   202     }
   203    
   203    
   204     
   204     
   205     if(!possibleLocation(reached)) {
   205     if(!possibleLocation(reached)) {
   206         Engine::log(DEBUG, "PhysicsObject.updatePosition") << "logic error reached should not be possible to be impossible.. diffVec: " << diffVec;
   206         Engine::log(DEBUG, "PhysicsObject.updatePosition") << "inside ground. diffVec: " << diffVec;
   207         func1();
   207         func1();
   208     }
   208     }
   209 
   209 
   210     // In case of some float error check the final coordinate
   210     // In case of some float error check the final coordinate
   211     if(!collided) {
   211     if(!collided) {
   214         } else {
   214         } else {
   215             // This means everything was ok, so no need to do anything
   215             // This means everything was ok, so no need to do anything
   216         }
   216         }
   217     } else {
   217     } else {
   218         newPosition = reached;
   218         newPosition = reached;
       
   219         this->position = newPosition;
   219         onCollision();
   220         onCollision();
   220         //TODO: It should be moved before onCollision, for Shots
   221         //TODO: It should be moved before onCollision, for Shots
   221     }
   222     }
   222     if(!possibleLocation(newPosition)) {
       
   223         Engine::log(DEBUG, "great failure") << "great failure";
       
   224         func1();
       
   225     }
       
   226     this->position = newPosition;
   223     this->position = newPosition;
   227     if(!possibleLocation(position)) {
       
   228         Engine::log(DEBUG, "great failure") << "great failure";
       
   229         func1();
       
   230     }
       
   231 //    Engine::log(DEBUG, "PhysicsObject.updatePosition") << "Pos: " << this->position;
   224 //    Engine::log(DEBUG, "PhysicsObject.updatePosition") << "Pos: " << this->position;
   232 }
   225 }
   233 
   226 
   234 /**
   227 /**
   235  * Bounces from straight wall in any direction.
   228  * Bounces from straight wall in any direction.