mirror of
https://github.com/orange-cpp/omath.git
synced 2026-06-09 08:44:35 +00:00
added rage engine support
This commit is contained in:
@@ -283,6 +283,34 @@ TEST(ProjectileSimulation, HitsNegativeYawTarget_WithOffset)
|
||||
expect_projectile_hits_target(proj, target, 400, 1.f / 1000.f, 50, 5.f, 10.f);
|
||||
}
|
||||
|
||||
TEST(ProjectileSimulation, HitsStaticTarget_WithAirFriction)
|
||||
{
|
||||
constexpr Target target{
|
||||
.m_origin = {75, 0, 0}, .m_velocity = {0, 0, 0}, .m_is_airborne = false};
|
||||
constexpr Projectile proj = {
|
||||
.m_origin = {0, 0, 0}, .m_launch_speed = 100.f, .m_gravity_scale = 0.f, .m_air_friction = 0.5f};
|
||||
|
||||
const Engine engine(0.f, 1.f / 1000.f, 10.f, 0.1f);
|
||||
const auto aim_angles = engine.maybe_calculate_aim_angles(proj, target);
|
||||
|
||||
ASSERT_TRUE(aim_angles.has_value());
|
||||
EXPECT_NEAR(aim_angles->pitch, 0.f, 0.1f);
|
||||
EXPECT_NEAR(aim_angles->yaw, 0.f, 0.1f);
|
||||
}
|
||||
|
||||
TEST(ProjectileSimulation, AirFrictionLimitsMaximumReach)
|
||||
{
|
||||
constexpr Target target{
|
||||
.m_origin = {150, 0, 0}, .m_velocity = {0, 0, 0}, .m_is_airborne = false};
|
||||
constexpr Projectile proj = {
|
||||
.m_origin = {0, 0, 0}, .m_launch_speed = 100.f, .m_gravity_scale = 0.f, .m_air_friction = 1.f};
|
||||
|
||||
const Engine engine(0.f, 1.f / 1000.f, 10.f, 0.1f);
|
||||
|
||||
EXPECT_FALSE(engine.maybe_calculate_aim_point(proj, target).has_value());
|
||||
EXPECT_FALSE(engine.maybe_calculate_aim_angles(proj, target).has_value());
|
||||
}
|
||||
|
||||
TEST(UnitTestPrediction, AimAnglesReturnsNulloptWhenNoSolution)
|
||||
{
|
||||
constexpr Target target{
|
||||
|
||||
Reference in New Issue
Block a user