Question about the game, how to make the shotgun bullets fly out with a spread?

If so then the bullets merge together when we shoot diagonally,

m_bullets.push_back(std::make_shared<CBullet>( sf::Vector2f{ direction.x - 0.05f, direction.y + 0.05f }, )); m_bullets.push_back(std::make_shared<CBullet> direction)); m_bullets.push_back(std::make_shared<CBullet>(sf::Vector2f{ direction.x + 0.05f, direction.y - 0.05f })); 

    1 answer 1

    It'll do?

      direction.x*cos(alpha)+direction.y*sin(alpha) -direction.x*sin(alpha)+direction.y*cos(alpha) 

    and set small alpha values. Sine and cosine can be predicted.

    • come down)) thanks - Kolya
    • Well, then mark the answer as accepted :) - Harry
    • Immediately it is impossible, after 8 minutes - Kolya
    • Yes, I do not insist on urgency :) - Harry