mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
added more classes
This commit is contained in:
21
source/projectile_prediction/Projectile.cpp
Normal file
21
source/projectile_prediction/Projectile.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Created by Vlad on 6/9/2024.
|
||||
//
|
||||
|
||||
#include "omath/projectile_prediction/Projectile.hpp"
|
||||
|
||||
#include <omath/engines/Source/Formulas.hpp>
|
||||
|
||||
namespace omath::projectile_prediction
|
||||
{
|
||||
Vector3 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
|
||||
Reference in New Issue
Block a user