This commit is contained in:
2024-05-07 02:12:16 +03:00
parent 98ffee501e
commit b11fdb8b26

View File

@@ -21,7 +21,7 @@ namespace uml::prediction
bool inAir) bool inAir)
{ {
constexpr float maxTime = 3.0f; constexpr float maxTime = 3.0f;
constexpr float timeStep = 0.01f; constexpr float timeStep = 0.001f;
for (float time = 0.0f; time <= maxTime; time += timeStep) for (float time = 0.0f; time <= maxTime; time += timeStep)
{ {
@@ -63,8 +63,8 @@ namespace uml::prediction
return std::nullopt; return std::nullopt;
} }
root = sqrt(root); root = sqrt(root);
float angle = atanf((powf(bulletSpeed, 2) - root) / (bulletGravity * distance)) * 180.f / (float)M_PI; float angle = atanf((powf(bulletSpeed, 2) - root) / (bulletGravity * distance));
return -angle; return -angles::RadToDeg(angle);
} }
float ProjectilePredictor::ProjectileTravelTime(float distance, float angle, float speed) float ProjectilePredictor::ProjectileTravelTime(float distance, float angle, float speed)