Skip to content

Commit

Permalink
UObjectHook: Clamp lerp alpha to 1 to fix strange bug
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Dec 14, 2023
1 parent 96fb829 commit 0ad0038
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void UObjectHook::tick_attachments(Rotator<float>* view_rotation, const float wo
}

const auto lenr = glm::max(1.0f, glm::length(right_hand_position - m_last_right_grip_location));
m_last_right_grip_location = glm::lerp(m_last_right_grip_location, right_hand_position, lerp_speed * lenr);
m_last_right_grip_location = glm::lerp(m_last_right_grip_location, right_hand_position, glm::min(1.0f, lerp_speed * lenr));
m_last_right_aim_rotation = glm::slerp(m_last_right_aim_rotation, right_hand_rotation, lerp_speed * spherical_distance_right);
right_hand_position = m_last_right_grip_location;
right_hand_rotation = m_last_right_aim_rotation;
Expand All @@ -435,7 +435,7 @@ void UObjectHook::tick_attachments(Rotator<float>* view_rotation, const float wo
}

const auto lenl = glm::max(1.0f, glm::length(left_hand_position - m_last_left_grip_location));
m_last_left_grip_location = glm::lerp(m_last_left_grip_location, left_hand_position, lerp_speed * lenl);
m_last_left_grip_location = glm::lerp(m_last_left_grip_location, left_hand_position, glm::min(1.0f, lerp_speed * lenl));
m_last_left_aim_rotation = glm::slerp(m_last_left_aim_rotation, left_hand_rotation, lerp_speed * spherical_distance_left);
left_hand_position = m_last_left_grip_location;
left_hand_rotation = m_last_left_aim_rotation;
Expand Down

0 comments on commit 0ad0038

Please sign in to comment.