add Comments

This commit is contained in:
Jakub-Prus 2023-02-13 15:35:55 +01:00
parent a1796fd0cd
commit 747aa7c8c9

View File

@ -379,6 +379,7 @@ void initBoids()
b.x = 0; b.x = 0;
b.y = 0; b.y = 0;
b.z = 0; b.z = 0;
// code with chatGPT help
b.vx = ((float)rand() / RAND_MAX) * MAX_SPEED * 2.0f - MAX_SPEED; b.vx = ((float)rand() / RAND_MAX) * MAX_SPEED * 2.0f - MAX_SPEED;
b.vy = ((float)rand() / RAND_MAX) * MAX_SPEED * 2.0f - MAX_SPEED; b.vy = ((float)rand() / RAND_MAX) * MAX_SPEED * 2.0f - MAX_SPEED;
b.vz = ((float)rand() / RAND_MAX) * MAX_SPEED * 2.0f - MAX_SPEED; b.vz = ((float)rand() / RAND_MAX) * MAX_SPEED * 2.0f - MAX_SPEED;
@ -446,6 +447,7 @@ void updateBoid(Boid& b) {
b.z += b.vz; b.z += b.vz;
// code with chatGPT help
if (b.x < -1.0f) { if (b.x < -1.0f) {
b.vx = abs(b.vx); b.vx = abs(b.vx);
} }