-
Автор темы
- #1
C++:
float PredictLBY(AimPlayer* data)
{
float predicted_lby = data->m_lowerbody;
LagRecord* latest_record = &data->m_records[0];
for (int i = 0; i < 12; i++)
{
LagRecord* record = &data->m_records[i];
if (!record->m_valid)
continue;
float delta = fabs(math::NormalizedAngle(record->m_lowerbody - latest_record->m_lowerbody));
float delta_time = record->m_sim_time - latest_record->m_sim_time;
if (delta > 35.f)
{
predicted_lby = record->m_lowerbody;
break;
}
if (delta_time >= 0.22f && delta_time <= 0.5f)
{
predicted_lby = record->m_lowerbody + (delta / delta_time) * g_global_vars->interval_per_tick;
break;
}
else if (delta_time > 0.5f)
{
predicted_lby = record->m_lowerbody;
break;
}
latest_record = record;
}
return predicted_lby;
}