diff --git a/src/Simulator.cpp b/src/Simulator.cpp index ace33e9..7c790d8 100644 --- a/src/Simulator.cpp +++ b/src/Simulator.cpp @@ -16,7 +16,9 @@ class Vector3; std::clock_t startTime = std::clock(); // Sets the constant -const float sol = 10.0; // Speed of light *should* be 1, but 10.0 make it compatible with old settings so I don't need to change the text in the creator +const float sol = 3.5; // Speed of light *should* be 1, but 3.5 make it compatible with old settings so I don't need to change the text in the creator +const float invsolsqr = 1.0f/(sol*sol); + // Defines a pointer to the screen size (needs to be accessible everywhere, but the Vector3 class is still undefined!) Vector3 *screenSize; @@ -239,7 +241,8 @@ struct Star void tick(float dt, bool relativistic) { if (true){ - acceleration = acceleration * (sol - sqrt(velocity.SqrMagnitude()))/sol; + // Lorentz scaling + acceleration = acceleration * sqrt(std::max(0.0f, (1 - velocity.SqrMagnitude()*invsolsqr))); }