tweaks to head turn

This commit is contained in:
NotAKidoS 2023-03-03 17:57:22 -06:00
parent a8cd7122a8
commit ff70ae9652
6 changed files with 39 additions and 32 deletions

View file

@ -1,6 +1,5 @@
using ABI_RC.Core;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.MovementSystem;
using System.Reflection;
@ -31,7 +30,7 @@ public class MSP_MenuInfo
internal static readonly FieldInfo _desktopMouseModeMM = typeof(CVR_MenuManager).GetField("_desktopMouseMode", BindingFlags.NonPublic | BindingFlags.Instance);
internal static readonly FieldInfo ms_followAngleY = typeof(MovementSystem).GetField("_followAngleY", BindingFlags.NonPublic | BindingFlags.Instance);
internal static bool independentHeadTurn = false;
internal static bool isIndependentHeadTurn = false;
internal static void ToggleDesktopInputMethod(bool flag)
{
@ -42,7 +41,6 @@ public class MSP_MenuInfo
RootLogic.Instance.ToggleMouse(flag);
CVRInputManager.Instance.inputEnabled = !flag;
PlayerSetup.Instance._movementSystem.disableCameraControl = flag;
CVR_MenuManager.Instance.desktopControllerRay.enabled = !flag;
}
@ -50,20 +48,22 @@ public class MSP_MenuInfo
{
//angle of independent look axis
bool isPressed = CVRInputManager.Instance.independentHeadTurn || CVRInputManager.Instance.independentHeadToggle;
if (isPressed && !independentHeadTurn)
if (isPressed && !isIndependentHeadTurn)
{
independentHeadTurn = true;
isIndependentHeadTurn = true;
MSP_MenuInfo.ToggleDesktopInputMethod(false);
QuickMenuHelper.Instance.UpdateWorldAnchors();
MainMenuHelper.Instance.UpdateWorldAnchors();
}
else if (!isPressed && independentHeadTurn)
else if (!isPressed && isIndependentHeadTurn)
{
float angle = (float)ms_followAngleY.GetValue(MovementSystem.Instance);
if (angle == 0f)
{
independentHeadTurn = false;
isIndependentHeadTurn = false;
MSP_MenuInfo.ToggleDesktopInputMethod(true);
QuickMenuHelper.Instance.NeedsPositionUpdate = true;
MainMenuHelper.Instance.NeedsPositionUpdate = true;
}
}
}