[ThirdPerson] Set camera cull mask instead of disabling

Least hacky fix to correct nameplate issue.
This commit is contained in:
NotAKidoS 2023-05-07 22:19:15 -05:00
parent 6f17010cae
commit 82eeced7cc
4 changed files with 10 additions and 18 deletions

View file

@ -1,9 +1,7 @@
using ABI.CCK.Components;
using ABI_RC.Core.Player;
using ABI_RC.Core.Util.Object_Behaviour;
using MelonLoader;
using System.Reflection;
using UnityEngine;
using static NAK.ThirdPerson.CameraLogic;
namespace NAK.ThirdPerson;
@ -24,16 +22,10 @@ internal static class Patches
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupIKScaling), BindingFlags.NonPublic | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnScaleAdjusted), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
harmony.Patch(
typeof(CameraFacingObject).GetMethod(nameof(CameraFacingObject.Start), BindingFlags.NonPublic | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnCameraFacingObjectStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
}
//Copy camera settings & postprocessing components
private static void OnWorldStart() => CopyPlayerCamValues();
//Adjust camera distance with height as modifier
private static void OnScaleAdjusted(float height) => AdjustScale(height);
//Fix bug when in thirdperson and desktop camera is disabled for performance
private static void OnCameraFacingObjectStart(ref Camera ___m_Camera) { if (___m_Camera == null) ___m_Camera = PlayerSetup.Instance.GetActiveCamera().GetComponent<Camera>(); }
}