mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-17 10:53:26 +00:00
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:
@@ -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{};
|
||||
|
||||
Reference in New Issue
Block a user