Refactors target position prediction

Moves target prediction logic into engine traits, improving modularity.

This change consolidates target position prediction within the engine traits,
allowing for a more flexible and maintainable design.

This eliminates redundant code and simplifies the core prediction engine by
delegating target movement calculations to the appropriate trait.
This commit is contained in:
2025-08-04 03:16:04 +03:00
parent 628361aff8
commit 5c9b36a03c
3 changed files with 30 additions and 24 deletions

View File

@@ -10,17 +10,6 @@ namespace omath::projectile_prediction
class Target final
{
public:
[[nodiscard]]
constexpr Vector3<float> predict_position(const float time, const float gravity) const noexcept
{
auto predicted = m_origin + m_velocity * time;
if (m_is_airborne)
predicted.z -= gravity * (time*time) * 0.5f;
return predicted;
}
Vector3<float> m_origin;
Vector3<float> m_velocity;
bool m_is_airborne{};