Added target altitude effect to simulated fire fight

This commit is contained in:
Pax1601
2023-09-22 16:05:03 +02:00
parent 18307caab3
commit f3155e618b
9 changed files with 56 additions and 21 deletions

View File

@@ -179,7 +179,7 @@ void GroundUnit::AIloop()
}
}
double barrelElevation = r * (9.81 * dist / (2 * muzzleVelocity * muzzleVelocity) - barrelHeight / dist); /* m */
double barrelElevation = r * (9.81 * dist / (2 * muzzleVelocity * muzzleVelocity) + (targetPosition.alt - (position.alt + barrelHeight)) / dist); /* m */
double lat = 0;
double lng = 0;

View File

@@ -568,7 +568,8 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
unitsManager->acquireControl(ID);
double lat = value[L"location"][L"lat"].as_double();
double lng = value[L"location"][L"lng"].as_double();
Coords loc; loc.lat = lat; loc.lng = lng;
double alt = value[L"altitude"].as_double();
Coords loc; loc.lat = lat; loc.lng = lng; loc.alt = alt;
Unit* unit = unitsManager->getGroupLeader(ID);
unit->setState(State::SIMULATE_FIRE_FIGHT);
unit->setTargetPosition(loc);