diff options
author | Aki <please@ignore.pl> | 2022-11-11 17:20:11 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-11-11 17:20:11 +0100 |
commit | 53d45e11743909b8816ef95f50ac1c2b6467a3b7 (patch) | |
tree | da8f95fd5f127ac2bb09a9662340b9877bb066d5 /battles/src/RandomSpawner.cpp | |
parent | bd8b0a9ba1bdd68b915fed75f1e901851b340efd (diff) | |
download | kurator-53d45e11743909b8816ef95f50ac1c2b6467a3b7.zip kurator-53d45e11743909b8816ef95f50ac1c2b6467a3b7.tar.gz kurator-53d45e11743909b8816ef95f50ac1c2b6467a3b7.tar.bz2 |
Changed rotation to be represented by angle
Diffstat (limited to 'battles/src/RandomSpawner.cpp')
-rw-r--r-- | battles/src/RandomSpawner.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/battles/src/RandomSpawner.cpp b/battles/src/RandomSpawner.cpp index a81a18c..b85d140 100644 --- a/battles/src/RandomSpawner.cpp +++ b/battles/src/RandomSpawner.cpp @@ -25,12 +25,16 @@ Transform RandomSpawner::get(const int team) { const double distance = distribution_d(device); - const double angle = angle_step * team + distribution_a(device); + const double clean_angle = angle_step * team; + const double angle = clean_angle + distribution_a(device); + double facing = clean_angle + M_PI; + if (facing > 2 * M_PI) + facing -= 2 * M_PI; const Point position { distance * std::cos(angle), distance * std::sin(angle), }; - return {position, {}}; + return {position, facing}; } |