[Solved] Odd Collision Issue

Ahoy!

So for a practice project, I decided to slowly build a tile system and really tear apart the collision so that I could understand it all. When doing so, I came across something I just can’t seem to figure out. Here is a photo:

Essentially, the block will get stuck in the wall before stopping, but not every time. The image shows an example along with the X collision handling and position/velocity handling, but it also occurs for the Y direction. What is a better method of collision that will allow me to avoid this?

Here is my getTiles method:

	public void getTiles(int startX, int startY, int endX, int endY){
		Level level = world.getLevel(); //Level has the tile array
		rectPool.freeAll(tiles); //don't know if I need to since its in the player class..
		tiles.clear();  //Clears rectangle array called tiles
		for(int x = startX; x <= endX; x++){ 
			for(int y = startY; y <= endY; y++){
				Tile tile = level.get(x, y); ///grab tile in that spot
				if(tile != null){ //if not null
					Rectangle rect = rectPool.obtain(); //grab rectangle out of pool
					rect.set(tile.getBounds()); //set it to the bounds of the tile
					tiles.add(rect); //add to rectangle array
				}
			}	
		}
	}

Thank you!

  • A

Edit* - The max speed of the player is 5f… in case that is relevant.