improved behavior near platform edges by checking the distance between the center of the game object and the platform edge