mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
dont change mouse input while in VR
bruh
This commit is contained in:
parent
72c9f12376
commit
77c1e0fea9
4 changed files with 39 additions and 35 deletions
|
@ -6,6 +6,7 @@ using cohtml;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NAK.Melons.MenuScalePatch.Helpers;
|
using NAK.Melons.MenuScalePatch.Helpers;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using MenuScalePatch.Helpers;
|
||||||
|
|
||||||
namespace NAK.Melons.MenuScalePatch.HarmonyPatches;
|
namespace NAK.Melons.MenuScalePatch.HarmonyPatches;
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,9 @@ using HarmonyLib;
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using NAK.Melons.MenuScalePatch.Helpers;
|
||||||
|
|
||||||
namespace NAK.Melons.MenuScalePatch.Helpers;
|
namespace MenuScalePatch.Helpers;
|
||||||
|
|
||||||
//TODO: Implement desktop ratio scaling back to MM
|
//TODO: Implement desktop ratio scaling back to MM
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ public class MainMenuHelper : MonoBehaviour
|
||||||
|
|
||||||
public void ToggleDesktopInputMethod(bool flag)
|
public void ToggleDesktopInputMethod(bool flag)
|
||||||
{
|
{
|
||||||
|
if (MetaPort.Instance.isUsingVr) return;
|
||||||
PlayerSetup.Instance._movementSystem.disableCameraControl = flag;
|
PlayerSetup.Instance._movementSystem.disableCameraControl = flag;
|
||||||
CVRInputManager.Instance.inputEnabled = !flag;
|
CVRInputManager.Instance.inputEnabled = !flag;
|
||||||
RootLogic.Instance.ToggleMouse(flag);
|
RootLogic.Instance.ToggleMouse(flag);
|
||||||
|
@ -65,12 +67,12 @@ public class MainMenuHelper : MonoBehaviour
|
||||||
GameObject vrAnchor = new GameObject("MSP_MMVR_Anchor");
|
GameObject vrAnchor = new GameObject("MSP_MMVR_Anchor");
|
||||||
vrAnchor.transform.parent = PlayerSetup.Instance.vrCameraRig.transform;
|
vrAnchor.transform.parent = PlayerSetup.Instance.vrCameraRig.transform;
|
||||||
vrAnchor.transform.localPosition = Vector3.zero;
|
vrAnchor.transform.localPosition = Vector3.zero;
|
||||||
this.worldAnchor = vrAnchor.transform;
|
worldAnchor = vrAnchor.transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateWorldAnchors()
|
public void UpdateWorldAnchors()
|
||||||
{
|
{
|
||||||
if (this.worldAnchor == null || MSP_MenuInfo.CameraTransform == null) return;
|
if (worldAnchor == null || MSP_MenuInfo.CameraTransform == null) return;
|
||||||
|
|
||||||
if (MetaPort.Instance.isUsingVr)
|
if (MetaPort.Instance.isUsingVr)
|
||||||
{
|
{
|
||||||
|
@ -78,18 +80,18 @@ public class MainMenuHelper : MonoBehaviour
|
||||||
float minTilt = MetaPort.Instance.settings.GetSettingsFloat("GeneralMinimumMenuTilt", 0f);
|
float minTilt = MetaPort.Instance.settings.GetSettingsFloat("GeneralMinimumMenuTilt", 0f);
|
||||||
if (zRotation <= minTilt || zRotation >= 360f - minTilt)
|
if (zRotation <= minTilt || zRotation >= 360f - minTilt)
|
||||||
{
|
{
|
||||||
this.worldAnchor.rotation = Quaternion.LookRotation(MSP_MenuInfo.CameraTransform.forward, Vector3.up);
|
worldAnchor.rotation = Quaternion.LookRotation(MSP_MenuInfo.CameraTransform.forward, Vector3.up);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.worldAnchor.eulerAngles = MSP_MenuInfo.CameraTransform.eulerAngles;
|
worldAnchor.eulerAngles = MSP_MenuInfo.CameraTransform.eulerAngles;
|
||||||
}
|
}
|
||||||
this.worldAnchor.position = MSP_MenuInfo.CameraTransform.position + MSP_MenuInfo.CameraTransform.forward * 2f * MSP_MenuInfo.ScaleFactor;
|
worldAnchor.position = MSP_MenuInfo.CameraTransform.position + MSP_MenuInfo.CameraTransform.forward * 2f * MSP_MenuInfo.ScaleFactor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.worldAnchor.eulerAngles = MSP_MenuInfo.CameraTransform.eulerAngles;
|
worldAnchor.eulerAngles = MSP_MenuInfo.CameraTransform.eulerAngles;
|
||||||
this.worldAnchor.position = MSP_MenuInfo.CameraTransform.position;
|
worldAnchor.position = MSP_MenuInfo.CameraTransform.position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,19 +143,18 @@ public class MainMenuHelper : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableMMHelper) return;
|
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableMMHelper) return;
|
||||||
|
|
||||||
Transform activeAnchor = independentHeadTurn ? this.worldAnchor : MSP_MenuInfo.CameraTransform;
|
Transform activeAnchor = independentHeadTurn ? worldAnchor : MSP_MenuInfo.CameraTransform;
|
||||||
this.transform.localScale = new Vector3(1.6f * MSP_MenuInfo.ScaleFactor, 0.9f * MSP_MenuInfo.ScaleFactor, 1f);
|
transform.localScale = new Vector3(1.6f * MSP_MenuInfo.ScaleFactor, 0.9f * MSP_MenuInfo.ScaleFactor, 1f);
|
||||||
this.transform.eulerAngles = activeAnchor.eulerAngles;
|
transform.eulerAngles = activeAnchor.eulerAngles;
|
||||||
this.transform.position = activeAnchor.position + activeAnchor.forward * 1f * MSP_MenuInfo.ScaleFactor;
|
transform.position = activeAnchor.position + activeAnchor.forward * 1f * MSP_MenuInfo.ScaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//VR Main Menu
|
//VR Main Menu
|
||||||
public void HandleVRPosition()
|
public void HandleVRPosition()
|
||||||
{
|
{
|
||||||
if (this.worldAnchor == null || MSP_MenuInfo.DisableMMHelper_VR) return;
|
if (worldAnchor == null || MSP_MenuInfo.DisableMMHelper_VR) return;
|
||||||
this.transform.localScale = new Vector3(1.6f * MSP_MenuInfo.ScaleFactor * 1.8f, 0.9f * MSP_MenuInfo.ScaleFactor * 1.8f, 1f);
|
transform.localScale = new Vector3(1.6f * MSP_MenuInfo.ScaleFactor * 1.8f, 0.9f * MSP_MenuInfo.ScaleFactor * 1.8f, 1f);
|
||||||
this.transform.position = this.worldAnchor.position;
|
transform.position = worldAnchor.position;
|
||||||
this.transform.eulerAngles = this.worldAnchor.eulerAngles;
|
transform.eulerAngles = worldAnchor.eulerAngles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,9 @@ using HarmonyLib;
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using NAK.Melons.MenuScalePatch.Helpers;
|
||||||
|
|
||||||
namespace NAK.Melons.MenuScalePatch.Helpers;
|
namespace MenuScalePatch.Helpers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ public class QuickMenuHelper : MonoBehaviour
|
||||||
|
|
||||||
public void ToggleDesktopInputMethod(bool flag)
|
public void ToggleDesktopInputMethod(bool flag)
|
||||||
{
|
{
|
||||||
|
if (MetaPort.Instance.isUsingVr) return;
|
||||||
PlayerSetup.Instance._movementSystem.disableCameraControl = flag;
|
PlayerSetup.Instance._movementSystem.disableCameraControl = flag;
|
||||||
CVRInputManager.Instance.inputEnabled = !flag;
|
CVRInputManager.Instance.inputEnabled = !flag;
|
||||||
RootLogic.Instance.ToggleMouse(flag);
|
RootLogic.Instance.ToggleMouse(flag);
|
||||||
|
@ -64,15 +66,15 @@ public class QuickMenuHelper : MonoBehaviour
|
||||||
GameObject vrAnchor = new GameObject("MSP_QMVR_Anchor");
|
GameObject vrAnchor = new GameObject("MSP_QMVR_Anchor");
|
||||||
vrAnchor.transform.parent = PlayerSetup.Instance.vrCameraRig.transform;
|
vrAnchor.transform.parent = PlayerSetup.Instance.vrCameraRig.transform;
|
||||||
vrAnchor.transform.localPosition = Vector3.zero;
|
vrAnchor.transform.localPosition = Vector3.zero;
|
||||||
this.worldAnchor = vrAnchor.transform;
|
worldAnchor = vrAnchor.transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateWorldAnchors()
|
public void UpdateWorldAnchors()
|
||||||
{
|
{
|
||||||
if (this.worldAnchor == null || MSP_MenuInfo.CameraTransform == null) return;
|
if (worldAnchor == null || MSP_MenuInfo.CameraTransform == null) return;
|
||||||
|
|
||||||
this.worldAnchor.eulerAngles = MSP_MenuInfo.CameraTransform.eulerAngles;
|
worldAnchor.eulerAngles = MSP_MenuInfo.CameraTransform.eulerAngles;
|
||||||
this.worldAnchor.position = MSP_MenuInfo.CameraTransform.position;
|
worldAnchor.position = MSP_MenuInfo.CameraTransform.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateMenuPosition()
|
public void UpdateMenuPosition()
|
||||||
|
@ -123,26 +125,26 @@ public class QuickMenuHelper : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableQMHelper) return;
|
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableQMHelper) return;
|
||||||
|
|
||||||
Transform activeAnchor = independentHeadTurn ? this.worldAnchor : MSP_MenuInfo.CameraTransform;
|
Transform activeAnchor = independentHeadTurn ? worldAnchor : MSP_MenuInfo.CameraTransform;
|
||||||
this.transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
|
transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
|
||||||
this.transform.eulerAngles = activeAnchor.eulerAngles;
|
transform.eulerAngles = activeAnchor.eulerAngles;
|
||||||
this.transform.position = activeAnchor.position + activeAnchor.transform.forward * 1f * MSP_MenuInfo.ScaleFactor;
|
transform.position = activeAnchor.position + activeAnchor.transform.forward * 1f * MSP_MenuInfo.ScaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//VR Quick Menu
|
//VR Quick Menu
|
||||||
public void HandleVRPosition()
|
public void HandleVRPosition()
|
||||||
{
|
{
|
||||||
if (this.handAnchor == null || MSP_MenuInfo.DisableQMHelper_VR) return;
|
if (handAnchor == null || MSP_MenuInfo.DisableQMHelper_VR) return;
|
||||||
|
|
||||||
if (MSP_MenuInfo.WorldAnchorQM)
|
if (MSP_MenuInfo.WorldAnchorQM)
|
||||||
{
|
{
|
||||||
this.transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
|
transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
|
||||||
this.transform.eulerAngles = this.worldAnchor.eulerAngles;
|
transform.eulerAngles = worldAnchor.eulerAngles;
|
||||||
this.transform.position = this.worldAnchor.position + this.worldAnchor.transform.forward * 1f * MSP_MenuInfo.ScaleFactor;
|
transform.position = worldAnchor.position + worldAnchor.transform.forward * 1f * MSP_MenuInfo.ScaleFactor;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
|
transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
|
||||||
this.transform.position = this.handAnchor.position;
|
transform.position = handAnchor.position;
|
||||||
this.transform.rotation = this.handAnchor.rotation;
|
transform.rotation = handAnchor.rotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,6 @@ using System.Reflection;
|
||||||
namespace MenuScalePatch.Properties;
|
namespace MenuScalePatch.Properties;
|
||||||
internal static class AssemblyInfoParams
|
internal static class AssemblyInfoParams
|
||||||
{
|
{
|
||||||
public const string Version = "4.0.0";
|
public const string Version = "4.0.1";
|
||||||
public const string Author = "NotAKidoS";
|
public const string Author = "NotAKidoS";
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue