public static float doFrictionY(float xv, float yv, float FRICTION) {
        float angle = (float) Math.atan(yv / xv);
        if (xv == 0) {
            if (yv == 0) {
                angle = 0;
            }
            angle = (float) Math.PI / 2;
        }

        // apply friction
        float fy = Math.abs(FRICTION * (float) Math.sin(angle));

        if (yv > 0) {
            yv -= fy;
            if (yv < 0) {
                yv = 0;
            }
        } else if (yv < 0) {
            yv += fy;
            if (yv > 0) {
                yv = 0;
            }
        } else {
            yv = 0;
        }
        return yv;
    }