Fix for the fcs

This commit is contained in:
esteldunedain 2015-04-06 18:43:32 -03:00
parent 09461d94ef
commit b20f3e5b81

View File

@ -58,12 +58,13 @@ double traceBullet(double initSpeed, double airFriction, double angle, double an
while (i < MAXITERATIONS) {
lastPosX = posX;
lastPosY = posY;
simulationStep = 0.1 - 0.049 * (posX / posTargetX);
velMag = sqrt(pow(velX, 2) + pow(velY, 2));
posX += velX * simulationStep * 0.5;
posY += velY * simulationStep * 0.5;
velX += simulationStep * (velX * velMag * airFriction);
velY += simulationStep * (velY * velMag * airFriction - 9.81);
posX += velX * simulationStep;
posY += velY * simulationStep;
velY += simulationStep * (velY * velMag * airFriction - 9.80665);
posX += velX * simulationStep * 0.5;
posY += velY * simulationStep * 0.5;
if (posX >= posTargetX) { break; }
i++;
}