can u fix my jump? void Player::Update(float deltaTime)
{
    float timestep = CTimer::GetTimeStep();
    //deltaTime *= 30;
    
    switch (m_state)
    {
    case PlayerState::STANDING:
        HandleStanding(timestep);
        break;
    case PlayerState::JUMPING:
        HandleJumping(timestep);
        break;
    case PlayerState::FALLING:
        HandleFalling(timestep);
        break;
    case PlayerState::LANDING:
        HandleStanding(timestep);
        break;
    default:
        break;
    }

    if (isPlayerInAir())
    {
        if (m_state != PlayerState::JUMPING && m_state != PlayerState::FALLING)
        {
            SetState(PlayerState::FALLING);
            std::cout << "Transitioning to FALLING state in Update." << std::endl;
        }
    }
    if (isPlayerInAir() && m_moveSpeed.y > 0.25f)
    {
        float airResistance = powf(0.95f, CTimer::GetTimeStep());
        m_moveSpeed *= airResistance;
        std::cout << "Applied air resistance. New m_moveSpeed: " << m_moveSpeed.y << std::endl;
    }

    if (isPlayerInAir())
    {
        ApplyGravity(timestep);
        ApplyAirResistance(timestep);
    }
   
    glm::vec3 newPosition = GetPosition(); 
    newPosition += m_moveSpeed * CTimer::GetTimeStep();
    SetPosition(newPosition);
    //CTimer::Update();
}

bool Player::isPlayerInAir()
{
    glm::vec3 playerPosition = GetPosition();
    glm::quat playerRotation = GetRotation();

    glm::vec3 downDirection(0.0f, -1.0f, 0.0f);
    float maxFallDistance = 1000.0f; 
    glm::vec3 raycastOrigin = playerPosition + glm::vec3(0.0f, 0.1f, 0.0f);
    auto fallResult = m_world->PlayerBoxRaycast(raycastOrigin, downDirection,
        maxFallDistance, m_playerDimensions, playerRotation);

    if (fallResult.hit)
    {
        if (fallResult.distance <= m_groundThreshold)
        {
            return false;
        }
    }
    return true;
}

glm::vec3 Player::GetGroundPos()
{
    glm::vec3 playerPosition = GetPosition();
    glm::quat playerRotation = GetRotation();

    glm::vec3 downDirection(0.0f, -1.0f, 0.0f);
    float maxFallDistance = 1000.0f;
    glm::vec3 raycastOrigin = playerPosition + glm::vec3(0.0f, m_groundThreshold, 0.0f);
    auto fallResult = m_world->PlayerBoxRaycast(raycastOrigin, downDirection,
        maxFallDistance, m_playerDimensions, playerRotation);

    if (fallResult.hit)
    {
        return fallResult.hitPoint;
    }
    return { 9999.0f, 9999.0f, 9999.0f };
}

void Player::ApplyGravity(float dt)
{
    //m_moveSpeed.y -= 9.81 * CTimer::GetTimeStep();
    m_moveSpeed.y -= 9.81 * 2.0f * CTimer::GetTimeStep();
}

void Player::ApplyAirResistance(float dt)
{
    if (m_fAirResistance > 0.1f) {
        float f = powf(m_fAirResistance, CTimer::GetTimeStep());
        m_moveSpeed *= f;
    }
    else {
        float magnitudeSqr = glm::length2(m_moveSpeed);
        float f = powf(1.0f / abs(m_fAirResistance * 0.5f * magnitudeSqr + 1.0f), CTimer::GetTimeStep());
        m_moveSpeed *= f;
    }
}

void Player::ApplyMoveForce(glm::vec3 force)
{
    m_moveSpeed += force * (1.0f / 70.0f);
}

void Player::Jump()
{
    if (m_state != PlayerState::JUMPING && !isPlayerInAir()) {
        SetState(PlayerState::JUMPING);
        ApplyMoveForce(glm::vec3(0.0f, 8.5f, 0.0f)); // Apply jump force on Y-axis
        std::cout << "Jump initiated!" << std::endl;
    }
}

void Player::HandleStanding(float dt)
{

}

void Player::HandleFalling(float dt)
{
    glm::vec3 pos = GetGroundPos();
    float dist = glm::distance(pos, m_position);
    if (dist >= 1000.0f)
    {
        std::cout << "Player under map! Hit Pos: "<< 
            pos.x << " " <<  pos.y  << " " <<  pos.z << std::endl;
        m_moveSpeed = { 0.0f, 0.0f,0.0f };
        SetPosition({ -15.3375, 17.5399 , 69.3102 });
    }
    else {
        if (dist <= m_groundThreshold)
        {
            m_moveSpeed = { 0.0f, 0.0f,0.0f };
            SetPosition(pos);
        }
    }
}

void Player::HandleJumping(float dt)
{
    //glm::vec3 pos = GetGroundPos();
    //float dist = glm::distance(pos, m_position);

    if (isPlayerInAir())
    {
        glm::vec3 eulerAngles = glm::eulerAngles(m_rotation);
        float angleSin = sin(eulerAngles.y);
        float angleCos = cos(eulerAngles.y);
        ApplyMoveForce({ -angleSin * 3.0f, 0.05f, 3.0f * angleCos });
        std::cout << "Applied move force during jumping." << std::endl;
    }

    /*if (dist <= m_groundThreshold)
    {
        SetState(PlayerState::STANDING);
        m_moveSpeed = { 0.0f, 0.0f,0.0f };
        SetPosition(pos);
    }
    else {
        
    }*/
}