# HG changeset patch # User nireco # Date 1228757245 0 # Node ID 809a0f84d581b53385d5a53f786928d0585e9d3f # Parent 4d3ebaa29430017df400ca960b07159818625bf7 bouncy bouncy diff -r 4d3ebaa29430 -r 809a0f84d581 src/PhysicsObject.cc --- 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