0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 21:10:45 -05:00

Improved ragdoll patch to only apply changes when vectors y and magnitude values match + y is over 5 - Appears to stop altering non-flying bot bots

This commit is contained in:
Dev 2024-06-28 11:12:51 +01:00
parent da0da8b0ab
commit cd190061cf

View File

@ -6,6 +6,9 @@ using UnityEngine;
namespace SPT.Custom.Patches
{
/// <summary>
/// On death some bots have a habit of flying upwards. We have found this occurs when the velocity y and magnitude match
/// </summary>
public class ClampRagdollPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
@ -16,7 +19,11 @@ namespace SPT.Custom.Patches
[PatchPrefix]
private static void PatchPreFix(ref Vector3 velocity)
{
velocity.y = Mathf.Clamp(velocity.y, -2f, 2f);
if (velocity.magnitude == velocity.y && velocity.y > 5)
{
// Probably flying upwards
velocity.y = 1;
}
}
}
}