mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 04:50: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:
parent
da0da8b0ab
commit
cd190061cf
@ -6,6 +6,9 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace SPT.Custom.Patches
|
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
|
public class ClampRagdollPatch : ModulePatch
|
||||||
{
|
{
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
@ -16,7 +19,11 @@ namespace SPT.Custom.Patches
|
|||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
private static void PatchPreFix(ref Vector3 velocity)
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user