mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 23:09:22 +00:00
[DesktopVRSwitch] Fixes for 2023r171
This commit is contained in:
parent
ba6a5f4778
commit
be82bf228c
12 changed files with 61 additions and 129 deletions
|
@ -1,4 +1,6 @@
|
|||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using ABI_RC.Systems.InputManagement.InputModules;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
|
@ -14,14 +16,17 @@ public class CVRInputManagerTracker : VRModeTracker
|
|||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||
}
|
||||
|
||||
void OnPostSwitch(bool intoVR)
|
||||
private void OnPostSwitch(bool intoVR)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Msg("Resetting CVRInputManager inputs.");
|
||||
|
||||
CVRInputManager.Instance.inputEnabled = true;
|
||||
|
||||
// IM CRYING
|
||||
CVRInputManager.Instance.reload = true;
|
||||
|
||||
//just in case
|
||||
CVRInputManager.Instance.blockedByUi = false;
|
||||
CVRInputManager.Instance.textInputFocused = false;
|
||||
//sometimes head can get stuck, so just in case
|
||||
CVRInputManager.Instance.independentHeadToggle = false;
|
||||
//just nice to load into desktop with idle gesture
|
||||
|
@ -31,5 +36,12 @@ public class CVRInputManagerTracker : VRModeTracker
|
|||
CVRInputManager.Instance.gestureRightRaw = 0f;
|
||||
//turn off finger tracking input
|
||||
CVRInputManager.Instance.individualFingerTracking = false;
|
||||
|
||||
//add input module if you started in desktop
|
||||
if (CVRInputManager._moduleXR == null)
|
||||
CVRInputManager.Instance.AddInputModule(CVRInputManager._moduleXR = new CVRInputModule_XR());
|
||||
|
||||
//enable xr input or whatnot
|
||||
CVRInputManager._moduleXR.InputEnabled = intoVR;
|
||||
}
|
||||
}
|
|
@ -8,12 +8,12 @@ public class CVRPickupObjectTracker : MonoBehaviour
|
|||
internal CVRPickupObject _pickupObject;
|
||||
internal Transform _storedGripOrigin;
|
||||
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
private void OnDestroy()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,15 @@ namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
|||
|
||||
public class CameraFacingObjectTracker : MonoBehaviour
|
||||
{
|
||||
CameraFacingObject _cameraFacingObject;
|
||||
private CameraFacingObject _cameraFacingObject;
|
||||
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
_cameraFacingObject = GetComponent<CameraFacingObject>();
|
||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
private void OnDestroy()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||
}
|
||||
|
|
|
@ -28,9 +28,10 @@ public class MovementSystemTracker : VRModeTracker
|
|||
|
||||
DesktopVRSwitch.Logger.Msg("Storing player world position and rotation.");
|
||||
|
||||
preSwitchWorldPosition = MovementSystem.Instance.rotationPivot.transform.position;
|
||||
var pivotTransform = MovementSystem.Instance.rotationPivot.transform;
|
||||
preSwitchWorldPosition = pivotTransform.position;
|
||||
preSwitchWorldPosition.y = MovementSystem.Instance.transform.position.y;
|
||||
preSwitchWorldRotation = MovementSystem.Instance.rotationPivot.transform.rotation;
|
||||
preSwitchWorldRotation = pivotTransform.rotation;
|
||||
|
||||
MovementSystem.Instance.ChangeCrouch(false);
|
||||
MovementSystem.Instance.ChangeProne(false);
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
using ABI_RC.Core.Player;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class VRTrackerManagerTracker : VRModeTracker
|
||||
{
|
||||
public override void TrackerInit()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
||||
}
|
||||
|
||||
public override void TrackerDestroy()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||
}
|
||||
|
||||
private void OnPostSwitch(bool intoVR)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Msg("Resetting VRTrackerManager.");
|
||||
|
||||
// VRTrackerManager will still get old Left/Right hand objects.
|
||||
// This only breaks CVRGlobalParams1 reporting battry status
|
||||
// MetaPort.Update
|
||||
|
||||
VRTrackerManager.Instance.poses = null;
|
||||
VRTrackerManager.Instance.leftHand = null;
|
||||
VRTrackerManager.Instance.rightHand = null;
|
||||
VRTrackerManager.Instance.hasCheckedForKnuckles = false;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ public class ViewManagerTracker : VRModeTracker
|
|||
VRModeSwitchManager.OnPreVRModeSwitch -= OnPreSwitch;
|
||||
}
|
||||
|
||||
public void OnPreSwitch(bool intoVR)
|
||||
private void OnPreSwitch(bool intoVR)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Msg("Closing ViewManager - Main Menu.");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue