I'm having problem with collision detection with my C++ game. I first tried AABB and successfully got it to detect collision but the problem was that I want to be able to push each other so I went with a basic solution to push both objects back half of the distance penetrated. But that only pushed the objects to a 45 degree angle to each other.Link to GIF explaining what i mean
IF YOU DON'T WANT TO READ SKIP THIS PARAGRAPH
So I figured that I need an direction to push the objects in, so I tried to modify some code from a tutorial. The direction is a normalized vector between the center of both objects. And then half of the collision depth is multiplied with the normalized vector so they get pushed in the opposite direction of each other. This worked but it used circular collision(it used radius + radius to calculate collision depth) and this meant that I couldn't use rectangles with different width and height, for instance 32x64 48x32(I had to use 32x32 48x48 64x64 and so on and so forth). This is a big problem because I NEED TO BE ABLE TO USE TEXTURES WITH DIFFERENT WIDTH AND HEIGHT.
So once again a went back to AABB and got it to work with out being able to push each other, so you just come to a complete stop. But the problem here is that when I collide on one axis I can't move in the other. For example, if I hold down UP and LEFT and collide with a wall on the LEFT i come to a complete stop instead of continue going UP where there is no wall.
SO WHAT I WANT HELP WITH IS either AABB collision where objects push each other with half of the distance penetrated in the correct direction or just plain AABB where you come to a complete stop BUT are able to walk in the non colliding direction when colliding on the other axis, for example Holding down up and down would result in this