src/proto2/Physics.cc
changeset 167 a55eff68aac8
parent 166 f72e131f626f
child 168 9436b89b0d28
--- a/src/proto2/Physics.cc	Mon Dec 01 22:36:32 2008 +0000
+++ b/src/proto2/Physics.cc	Mon Dec 01 22:58:15 2008 +0000
@@ -144,6 +144,10 @@
     // hack. I think we should handle walking from the collision
     // detection code.
 
+    if (this->velocity.sqrLength() < PLAYER_MIN_SPEED * PLAYER_MIN_SPEED) {
+        this->inAir = !world.collides(this->position+shape[2]+Vector(0, 1));
+    }
+
     if (!this->inAir) {
         if (total.x != 0)
             this->position = walk(total.x > 0);
@@ -176,7 +180,7 @@
                 }
                 reached = reached - unitVector; // Return to last point
                 collided = true;
-                if (this->velocity.length() < PLAYER_MIN_SPEED) {
+                if (this->velocity.sqrLength() < PLAYER_MIN_SPEED * PLAYER_MIN_SPEED) {
                     this->inAir = false;
                     this->velocity = Vector(0,0);
                 }