diff -r 9b682981e060 -r 39e59dd36b6e src/PhysicsObject.cc --- a/src/PhysicsObject.cc Tue Dec 09 04:49:33 2008 +0000 +++ b/src/PhysicsObject.cc Mon Dec 15 14:24:38 2008 +0000 @@ -35,10 +35,13 @@ Vector PhysicsObject::walk_one_step (float partial, bool right) { // which way we are walking float deltaX = right ? partial : -partial; + Vector reached = this->position; - if(reached.roundToInt() == (reached+Vector(deltaX, 0)).roundToInt()) { - return reached+Vector(deltaX, 0); + + if (reached.roundToInt() == (reached + Vector(deltaX, 0)).roundToInt()) { + return reached + Vector(deltaX, 0); } + // Is there upward ramp if(!possibleLocation(position+Vector(deltaX, 0))) { // Yes. Then we check n pixels up @@ -211,13 +214,14 @@ collisionPoint = reached+shape[i]; if (inAir) - this->bounce(world.getNormal(reached+shape[i], reached-unitVector+shape[i])); + this->bounce(world.getNormal(reached + shape[i], reached - unitVector + shape[i])); reached = reached - unitVector; // Return to last point collided = true; - + + // snap velocity to zero once it's below a threshold if (this->velocity.sqrLength() < PLAYER_MIN_SPEED * PLAYER_MIN_SPEED) - this->velocity = Vector(0,0); + this->velocity = Vector(0, 0); break; }