Files
omath/source/projectile_prediction/Projectile.cpp
Vladislav Alpatov 6d0d267743 now template
2025-03-01 21:11:46 +03:00

22 lines
819 B
C++

//
// Created by Vlad on 6/9/2024.
//
#include "omath/projectile_prediction/Projectile.hpp"
#include <omath/engines/Source/Formulas.hpp>
namespace omath::projectile_prediction
{
Vector3<float> Projectile::PredictPosition(const float pitch, const float yaw, const float time, const float gravity) const
{
auto currentPos = m_origin + source::ForwardVector({source::PitchAngle::FromDegrees(-pitch),
source::YawAngle::FromDegrees(yaw),
source::RollAngle::FromDegrees(0)}) *
m_launchSpeed * time;
currentPos.z -= (gravity * m_gravityScale) * (time * time) * 0.5f;
return currentPos;
}
} // namespace omath::prediction