Skip to content

Commit

Permalink
Reduces the max error down to 0.02 Mil at simulationIntervals up to…
Browse files Browse the repository at this point in the history
… 0.05s
  • Loading branch information
ulteq committed Oct 28, 2017
1 parent 39d9a34 commit dc84082
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions extensions/advanced_ballistics/AdvancedBallistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,10 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
}

std::vector<double> bulletVelocity = bulletDatabase[index].bulletVelocity;
double time = 0.0f;
double dt = DT_SIMULATION;
double time = 0.0;

while (time < deltaT) {
dt = std::min(deltaT - time, DT_SIMULATION);
double dt = std::min(deltaT - time, DT_SIMULATION);

double bulletSpeed = sqrt(pow(bulletVelocity[0], 2) + pow(bulletVelocity[1], 2) + pow(bulletVelocity[2], 2));

Expand All @@ -551,12 +550,11 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
}

bulletVelocity = bulletDatabase[index].bulletVelocity;
time = 0.0f;
dt = DT_SIMULATION;
time = 0.0;
TOF -= deltaT;

while (time < deltaT) {
dt = std::min(deltaT - time, DT_SIMULATION);
double dt = std::min(deltaT - time, DT_SIMULATION * 2);

trueVelocity[0] = bulletVelocity[0] - wind[0];
trueVelocity[1] = bulletVelocity[1] - wind[1];
Expand Down

0 comments on commit dc84082

Please sign in to comment.