Libgdx FirstPersonCamera smooth collision?

I have made collision for my game however it is horrible ??? every time i glide against a wall i get stuck and I have no idea how to imporve this other then not to use FirstPersonController (From Libgdx)

Code

public static Vector3 collision(MapModel map, Vector3 oldPos,Vector3 newPos, float width, float length) {
		int w = map.getPixMap().getWidth();
		int h = map.getPixMap().getHeight();
		
		
		
		float blockWidth = CreateMap.BLOCK_WIDTH;
		float blockLength = CreateMap.BLOCK_LENGTH;

		for (int x = 0; x < w; x++) {
			for (int z = 0; z < h; z++) {
				
				float blockPosX = x*blockWidth;
				float blockPosZ = z*blockLength;
				
				if(CreateMap.outBounds(map.getPixMap(), x, z)){
					if(newPos.x+width > blockPosX && newPos.x - width < blockPosX + blockWidth
							&& newPos.z+length > blockPosZ && newPos.z - length < blockPosZ + blockLength){
						return oldPos;
					}
				}
			}
		}
		return newPos;
	}