void RLBotBot::RenderTimeToReachBall(const RLGSC::GameState& gs) {
    rlbot::ScopedRenderer renderer("time_to_reach_ball");

    const auto& localPlayer = gs.players[index];
    const Vec& ballPos = gs.ball.pos;

    auto calculateMinAirTime = [](const Vec& playerPos, const Vec& playerVel, bool hasFlip) {
        constexpr float GRAVITY = 650.0f;
        // Calculate time to reach ground
        float timeToGround = RS_MAX(0.0f, (-playerVel.z + std::sqrt(playerVel.z * playerVel.z + 2 * GRAVITY * playerPos.z)) / GRAVITY);
        // Calculate time to reach side walls
        float timeToSideWall = (playerVel.x != 0) ? RS_MIN(
            std::abs((CommonValues::SIDE_WALL_X - playerPos.x) / playerVel.x),
            std::abs((-CommonValues::SIDE_WALL_X - playerPos.x) / playerVel.x)
        ) : std::numeric_limits<float>::infinity();
        // Calculate time to reach back walls
        float timeToBackWall = (playerVel.y != 0) ? RS_MIN(
            std::abs((CommonValues::BACK_WALL_Y - playerPos.y) / playerVel.y),
            std::abs((-CommonValues::BACK_WALL_Y - playerPos.y) / playerVel.y)
        ) : std::numeric_limits<float>::infinity();
        // Calculate time to reach ceiling
        float timeToCeiling = (playerVel.z > 0) ? (CommonValues::CEILING_Z - playerPos.z) / playerVel.z : std::numeric_limits<float>::infinity();
        // Return the minimum time to reach any surface
        return RS_MIN(RS_MIN(timeToGround, timeToSideWall), RS_MIN(timeToBackWall, timeToCeiling));
        };

    auto getTimeToReachBall = [&calculateMinAirTime](const PlayerData& player, const Vec& ballPos, std::vector<Vec>& path) {
        constexpr float MAX_ROTATION_SPEED = 5.5f;
        constexpr float DIST_REACH_THRESH = 10.0f;
        constexpr float STEP_INTERVAL = 1.0f / 60.0f;
        constexpr float FLIP_FORCE = 500.0f;
        constexpr float AIR_ACCEL = 66.66667f;
        constexpr float BOOST_ACCEL_AIR = 1058.33333f;
        constexpr float MAX_TOTAL_SPEED = 2300.0f;
        constexpr float BREAK_ACCEL = 3500.0f;
        constexpr float BOOST_ACCEL_GROUND = 991.66667f;
        constexpr float DRIVE_ACCEL = 1600.0f;
        constexpr float MAX_DRIVE_SPEED = 1410.0f;

        const Vec& playerPos = player.phys.pos;
        const Vec& playerForward = player.phys.rotMat.forward;
        const Vec& playerVel = player.phys.vel;
        bool hasFlip = player.carState.HasFlipOrJump();
        float dist = (ballPos - playerPos).Length();
        Vec dirToBall = (ballPos - playerPos) / dist;
        Vec normalizedDirToBall = dirToBall / dirToBall.Length();
        float curVel = playerVel.Dot(normalizedDirToBall);
        float angleDiff = std::acos(RS_CLAMP(playerForward.Dot(normalizedDirToBall), -1.0f, 1.0f));
        float rotTime = angleDiff / MAX_ROTATION_SPEED;
        float t = 0;
        float curDist = dist;

        path.push_back(playerPos);
        float nextPointTime = 0.2f;

        // Calculate minimum air time
        float minAirTime = calculateMinAirTime(playerPos, playerVel, hasFlip);

        // Air movement
        while (t < minAirTime && curDist > DIST_REACH_THRESH) {
            bool hasRotated = t >= rotTime;
            if (hasFlip && t == 0) {
                curVel += FLIP_FORCE;
            }
            float airAccel = AIR_ACCEL + (BOOST_ACCEL_AIR * hasRotated);
            curVel += airAccel * STEP_INTERVAL;
            curVel = RS_MIN(curVel, MAX_TOTAL_SPEED);
            curDist -= curVel * STEP_INTERVAL;
            t += STEP_INTERVAL;

            if (t >= nextPointTime) {
                path.push_back(playerPos + normalizedDirToBall * (dist - curDist));
                nextPointTime += 0.2f;
            }
        }

        // Ground movement
        while (curDist > DIST_REACH_THRESH) {
            bool hasRotated = t >= rotTime;
            if (curVel < 0) {
                curVel += (BREAK_ACCEL + BOOST_ACCEL_GROUND * hasRotated) * STEP_INTERVAL;
            }
            else if (curVel < MAX_DRIVE_SPEED) {
                curVel += (DRIVE_ACCEL + BOOST_ACCEL_GROUND * hasRotated) * STEP_INTERVAL;
            }
            else if (curVel < MAX_TOTAL_SPEED) {
                curVel += BOOST_ACCEL_GROUND * hasRotated * STEP_INTERVAL;
            }
            else {
                float remainingTime = curDist / curVel;
                t += remainingTime;
                path.push_back(ballPos);
                return t;
            }
            curDist -= curVel * STEP_INTERVAL;
            t += STEP_INTERVAL;

            if (t >= nextPointTime) {
                path.push_back(playerPos + normalizedDirToBall * (dist - curDist));
                nextPointTime += 0.2f;
            }
        }
        return t;
        };

    std::vector<Vec> path;
    float timeToReach = getTimeToReachBall(localPlayer, ballPos, path);

    // Render the time estimate as text above the ball
    std::stringstream ss;
    ss << std::fixed << std::setprecision(2) << "Time to reach: " << timeToReach << "s";
    rlbot::flat::Vector3 textPos = {
        static_cast<float>(ballPos.x),
        static_cast<float>(ballPos.y),
        static_cast<float>(ballPos.z + 200)
    };
    renderer.DrawString3D(ss.str(), rlbot::Color::white, textPos, 1.0f, 1.0f);

    // Render points and times along the path
    for (size_t i = 0; i < path.size(); ++i) {
        const Vec& pointPos = path[i];
        float t = i * 0.2f;

        rlbot::flat::Vector3 renderPos = {
            static_cast<float>(pointPos.x),
            static_cast<float>(pointPos.y),
            static_cast<float>(pointPos.z)
        };

        // Render a small rectangle at this point
        renderer.DrawRect3D(rlbot::Color::yellow, renderPos, 10, 10, true);

        // Render the time at this point
        std::stringstream pointSs;
        pointSs << std::fixed << std::setprecision(1) << t << "s";
        rlbot::flat::Vector3 textPos = {
            static_cast<float>(pointPos.x),
            static_cast<float>(pointPos.y),
            static_cast<float>(pointPos.z + 50)
        };
        renderer.DrawString3D(pointSs.str(), rlbot::Color::yellow, textPos, 1.0f, 1.0f);
    }

    // Draw the path
    std::vector<rlbot::flat::Vector3> points;
    std::vector<const rlbot::flat::Vector3*> pointPtrs;
    for (const auto& point : path) {
        points.push_back({ static_cast<float>(point.x), static_cast<float>(point.y), static_cast<float>(point.z) });
    }
    for (const auto& point : points) {
        pointPtrs.push_back(&point);
    }
    renderer.DrawPolyLine3D(rlbot::Color::yellow, pointPtrs);
} why is the max time 2 sec fix the code to make the max time the time too the ball then make the 0.2 second points between that