From 3f1042667923fffef624c4ac07c67d8cea05daf5 Mon Sep 17 00:00:00 2001 From: COW_ILLUMINATI Date: Wed, 1 May 2024 18:34:09 -0400 Subject: [PATCH] Camera tracks center --- Gal_data/Sim_Settings | 4 ++-- src/Simulator.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Gal_data/Sim_Settings b/Gal_data/Sim_Settings index a00e3d2..fbea9ac 100644 --- a/Gal_data/Sim_Settings +++ b/Gal_data/Sim_Settings @@ -1,3 +1,3 @@ -0.1 -150 +0.01 +200 0 diff --git a/src/Simulator.cpp b/src/Simulator.cpp index 7c790d8..28f43b6 100644 --- a/src/Simulator.cpp +++ b/src/Simulator.cpp @@ -412,8 +412,9 @@ int main() { std::clock_t prevClock = startTime; bool pushframe = false; - // Camera will be centered on this star - int trackedStar = 0; + // Camera will be centered on these stars + int trackedStarA = 0; + int trackedStarB = 1; // Initialize the camera position Vector3 cameraPosition = Vector3(0,0,0); @@ -499,7 +500,7 @@ int main() { } // New position - cameraPosition = stars[trackedStar].position; + cameraPosition = (stars[trackedStarA].position + stars[trackedStarB].position)/2; // Pushes the frame SDL_RenderPresent(renderer); @@ -546,7 +547,8 @@ int main() { playing = !playing; break; case SDLK_RETURN: - trackedStar = rand() % starCount; + trackedStarA = rand() % starCount; + trackedStarB = trackedStarA; break; } break;