@FinalSpace
It happens with Box2D and Chipmunk because you are setting the position variable directly:
b->position.Set(6.0f, -tileSize * 0.5f); /* Code that I see in your video */
which you shouldn't do (in Box2D or Chipmunk). If, instead, you just set the velocity in Box2D or Chipmunk, it's unlikely that it will happen. It might get stuck in one of the corners, but not... stuck stuck... you can still move. It's unlikely that it happens setting velociy, because when you set the velocity, the engine (Box2D and Chipmunk) will record variables regarding the motion to solve later penetration in solids. Since you are making your own physics engine, I imagine here is where it differs from Box2D and Chipmunk:
* Chipmunk and Box2D use **iterative solver**, which makes objects impossible (theoritically) to get stuck forever.
The iterative solver will move the object penetrating by a specified amount of units. That's why these two physics engine aren't nice for 2D games trying to simulate the old school platformers or top down. The iterative solver isn't perfect, because it **WILL** let objects penetrate (undesired), and then it will solve little by little the collision, making collisions with walls look like collisions with cushions (and it is a PAIN IN THE ASS to make it look good). So, I don't think you can compare your physics with Box2D/Chipmunk (and I don't recommend you to use them, because by the looks of your game, you don't want tha cushion-like effect).
People using Game Maker often uses the following approach, and it's very suitable for non-iterative solvers (which seems to be your case):
h_speed = /* My horizontal speed here */;
if (overlapping(x + h_speed, y, "wall")) {
/* We will collide with this horizontal move */
while (!overlapping(x+sign(h_speed), y, "wall")) {
/* We move 1 by 1 px until we reach the limit without collision */
x = x + sign(h_speed);
}
h_speed = 0;
}
x = x + h_speed; /* The original speed or 0 if was solved above */
There's a youtube tutorial here: www.youtube.com/ watch?v=IysShLIaosk