[IKSimulatedRootAngleFix] Fixed reset method so torso faces forward properly

This commit is contained in:
NotAKidoS 2024-06-27 21:08:01 -05:00
parent 8c2943ae99
commit 2ad8a2c0f7

View file

@ -21,6 +21,13 @@ public class IKSimulatedRootAngleFixMod : MelonMod
BindingFlags.NonPublic | BindingFlags.Static))
);
HarmonyInstance.Patch( // fix offsetting of _ikSimulatedRootAngle when player rotates on wall or ceiling
typeof(IKHandler).GetMethod(nameof(IKHandler.Reset),
BindingFlags.Public | BindingFlags.Instance),
postfix: new HarmonyMethod(typeof(IKSimulatedRootAngleFixMod).GetMethod(nameof(OnHandlerReset),
BindingFlags.NonPublic | BindingFlags.Static))
);
HarmonyInstance.Patch( // why did i dupe logic weirdly between Desktop & VR IKHandler ...
typeof(IKHandlerDesktop).GetMethod(nameof(IKHandlerDesktop.HandleBodyHeading),
BindingFlags.NonPublic | BindingFlags.Instance),
@ -68,6 +75,11 @@ public class IKSimulatedRootAngleFixMod : MelonMod
return false;
}
private static void OnHandlerReset(ref IKHandler __instance)
{
__instance._ikSimulatedRootAngle = GetRemappedPlayerHeading();
}
private static bool OnHandleBodyHeading(ref IKHandlerDesktop __instance)
{
if (IKSystem.Instance.BodyHeadingLimit <= 0f)