-
Автор темы
- #1
C++:
void PredictLBY(AimPlayer* data, LagRecord* record) {
// get predicted away angle for the player.
float away = GetAwayAngle(record);
// Get the delta between the current body and move angles.
float delta = math::NormalizedAngle(record->m_body - data->m_walk_record.m_body);
// Check if the delta is within a valid range (eg 90 to 180 degrees).
if (delta >= 90.0f && delta <= 180.0f) {
// Check if the current record's animation time is greater than or equal to the body update time.
if (record->m_anim_time >= data->m_body_update) {
// Check if the current body index is less than or equal to 3.
if (data->m_body_index <= 3) {
// Predict the LBY angle to be the current body angle.
record->m_predicted_lby = record->m_body;
// Update the body update time to be the current animation time plus a constant value (eg 1.1 seconds).
data->m_body_update = record->m_anim_time + 1.1f;
} else {
// If the body index is greater than 3, use the predicted away angle as the LBY angle.
record->m_predicted_lby = away;
}
} else {
// If the current animation time is less than the body update time, predict the LBY angle to be the previous move body angle.
record->m_predicted_lby = data->m_walk_record.m_body;
}
} else {
// If the delta is not within a valid range, predict the LBY angle to be the previous move body angle.
record->m_predicted_lby = data->m_walk_record.m_body;
}
}