diff options
| author | ilotterytea <iltsu@alright.party> | 2024-12-10 21:49:41 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-12-10 21:49:41 +0500 |
| commit | a7d86efdb931a9587f0dffa1542569a562ce9a1b (patch) | |
| tree | c739df329ecb7c04f2f2b8e74c582aed48b88a48 | |
| parent | a4acf6550319d307f318e69695838ce5d1abc263 (diff) | |
fix: stars were positioned in spiral
| -rw-r--r-- | src/star.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -7,11 +7,13 @@ #include "raylib.h" Vector3 Generate3DPosition() { - double random = (double)rand() / RAND_MAX; + double angle_random = (double)rand() / (double)RAND_MAX; + double radius_random = (double)rand() / (double)RAND_MAX; - double angle = random * 2.0 * M_PI; - double radius = - (GetScreenHeight() / SPACE_SIZE) + (random * GetScreenHeight()); + double angle = angle_random * 2.0 * M_PI; + + double radius = (GetScreenHeight() / SPACE_SIZE) + + (radius_random * GetScreenHeight()) * SPACE_SIZE; float x = radius * sin(angle); float y = radius * cos(angle); |
