src/PhysicsObject.cc
changeset 297 809a0f84d581
parent 288 47a5d7896aec
child 299 e4dacf550ba1
--- a/src/PhysicsObject.cc	Mon Dec 08 17:24:40 2008 +0000
+++ b/src/PhysicsObject.cc	Mon Dec 08 17:27:25 2008 +0000
@@ -200,11 +200,13 @@
    
     const Vector diffVec = newPosition - position;
     const Vector unitVector = diffVec / diffVec.length();
+    if(unitVector == Vector(0, 0)) {
+        return;
+    }
     Vector reached = position;
     
     while ((position - reached).sqrLength() < diffVec.sqrLength()) {
         reached += unitVector;
-
         // Check if any of the shapes points collide
         for (uint64_t i = 0; i < shape.size(); i++) {
             if (world.collides(reached+shape[i])) {  // Collision