From f5066fe62bd62f8a5bfb488fe6da8d5648e431bc Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Mon, 10 Dec 2007 21:51:49 +0000 Subject: fixed the corner bug. I hope --- src/game/game.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/game') diff --git a/src/game/game.cpp b/src/game/game.cpp index 79ef8e1a..2632b64b 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -75,15 +75,17 @@ void move_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity) vec2 new_pos = pos + vel*fraction; // TODO: this row is not nice - if(test_box(new_pos, size)) + // make sure that we quantize. this is to make sure that when we set + // the final position that we don't move it into the ground. + if(test_box(vec2((int)new_pos.x,(int) new_pos.y), size)) { - if(test_box(vec2(pos.x, new_pos.y), size)) + if(test_box(vec2((int)pos.x, (int)new_pos.y), size)) { new_pos.y = pos.y; vel.y *= -elasticity; } - if(test_box(vec2(new_pos.x, pos.y), size)) + if(test_box(vec2((int)new_pos.x, (int)pos.y), size)) { new_pos.x = pos.x; vel.x *= -elasticity; -- cgit 1.4.1