relativity
This commit is contained in:
parent
8cc0eb7d49
commit
bc1f3b69a8
@ -16,7 +16,9 @@ class Vector3;
|
|||||||
std::clock_t startTime = std::clock();
|
std::clock_t startTime = std::clock();
|
||||||
|
|
||||||
// Sets the constant
|
// 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!)
|
// Defines a pointer to the screen size (needs to be accessible everywhere, but the Vector3 class is still undefined!)
|
||||||
Vector3 *screenSize;
|
Vector3 *screenSize;
|
||||||
@ -239,7 +241,8 @@ struct Star
|
|||||||
void tick(float dt, bool relativistic) {
|
void tick(float dt, bool relativistic) {
|
||||||
|
|
||||||
if (true){
|
if (true){
|
||||||
acceleration = acceleration * (sol - sqrt(velocity.SqrMagnitude()))/sol;
|
// Lorentz scaling
|
||||||
|
acceleration = acceleration * sqrt(std::max(0.0f, (1 - velocity.SqrMagnitude()*invsolsqr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user