diff --git a/DesktopVRIK/HarmonyPatches.cs b/DesktopVRIK/HarmonyPatches.cs index eb6a564..3b9b541 100644 --- a/DesktopVRIK/HarmonyPatches.cs +++ b/DesktopVRIK/HarmonyPatches.cs @@ -111,7 +111,7 @@ internal class PlayerSetupPatches return; CVRMovementParent currentParent = __instance._movementSystem._currentParent; - __runOriginal = currentParent?._referencePoint != null + __runOriginal = (currentParent != null && currentParent._referencePoint != null) ? IKManager.Instance.OnPlayerHandleMovementParent(currentParent) : IKManager.Instance.OnPlayerTeleported(); } diff --git a/DesktopVRIK/IK/IKHandlers/IKHandler.cs b/DesktopVRIK/IK/IKHandlers/IKHandler.cs index 06932d0..650141a 100644 --- a/DesktopVRIK/IK/IKHandlers/IKHandler.cs +++ b/DesktopVRIK/IK/IKHandlers/IKHandler.cs @@ -48,12 +48,15 @@ internal abstract class IKHandler { Vector3 currentPosition = currentParent._referencePoint.position; Quaternion currentRotation = Quaternion.Euler(0f, currentParent.transform.rotation.eulerAngles.y, 0f); - - Vector3 deltaPosition = currentPosition - _movementPosition; - Quaternion deltaRotation = Quaternion.Inverse(_movementRotation) * currentRotation; - - if (_movementParent == currentParent) + + if (_movementParent != null && _movementParent == currentParent) { + Vector3 deltaPosition = currentPosition - _movementPosition; + Quaternion deltaRotation = Quaternion.identity; + + if (currentParent.orientationMode == CVRMovementParent.OrientationMode.RotateWithParent) + deltaRotation = Quaternion.Inverse(_movementRotation) * currentRotation; + _solver.AddPlatformMotion(deltaPosition, deltaRotation, platformPivot); _ikSimulatedRootAngle = Mathf.Repeat(_ikSimulatedRootAngle + deltaRotation.eulerAngles.y, 360f); } diff --git a/DesktopVRIK/IK/IKManager.cs b/DesktopVRIK/IK/IKManager.cs index 313e35c..4f2b0a8 100644 --- a/DesktopVRIK/IK/IKManager.cs +++ b/DesktopVRIK/IK/IKManager.cs @@ -26,7 +26,6 @@ public class IKManager : MonoBehaviour // Player Info internal Transform _desktopCamera; internal Transform _vrCamera; - private bool _isEmotePlaying; // Avatar Info private Animator _animator; diff --git a/DesktopVRIK/Properties/AssemblyInfo.cs b/DesktopVRIK/Properties/AssemblyInfo.cs index 25f5ef4..400b8d2 100644 --- a/DesktopVRIK/Properties/AssemblyInfo.cs +++ b/DesktopVRIK/Properties/AssemblyInfo.cs @@ -28,6 +28,6 @@ using System.Reflection; namespace NAK.DesktopVRIK.Properties; internal static class AssemblyInfoParams { - public const string Version = "4.2.5"; + public const string Version = "4.2.6"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/DesktopVRIK/format.json b/DesktopVRIK/format.json index 883efce..7b7bdb4 100644 --- a/DesktopVRIK/format.json +++ b/DesktopVRIK/format.json @@ -1,8 +1,8 @@ { "_id": 117, "name": "DesktopVRIK", - "modversion": "4.2.5", - "gameversion": "2023r171", + "modversion": "4.2.6", + "gameversion": "2023r172", "loaderversion": "0.6.1", "modtype": "Mod", "author": "NotAKidoS", @@ -17,8 +17,8 @@ "requirements": [ "BTKUILib" ], - "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r19/DesktopVRIK.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r21/DesktopVRIK.dll", "sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/DesktopVRIK/", - "changelog": "- Potential fix for PlayerSetup.ResetIk not running in Halfbody.", + "changelog": "- Movement Parent IK handling now respects new orientation mode.", "embedcolor": "#9b59b6" } \ No newline at end of file diff --git a/DesktopVRSwitch/VRModeTrackers/CVRInputManagerTracker.cs b/DesktopVRSwitch/VRModeTrackers/CVRInputManagerTracker.cs index b2cc3f4..b5caf88 100644 --- a/DesktopVRSwitch/VRModeTrackers/CVRInputManagerTracker.cs +++ b/DesktopVRSwitch/VRModeTrackers/CVRInputManagerTracker.cs @@ -1,5 +1,7 @@ -using ABI_RC.Systems.InputManagement; +using ABI_RC.Core; +using ABI_RC.Systems.InputManagement; using ABI_RC.Systems.InputManagement.InputModules; +using ABI_RC.Systems.InputManagement.XR.Modules; namespace NAK.DesktopVRSwitch.VRModeTrackers; @@ -24,6 +26,16 @@ public class CVRInputManagerTracker : VRModeTracker // IM CRYING //CVRInputManager.Instance.reload = true; + // set to null so input manager doesnt attempt to access it + if (CVRInputManager._moduleXR._leftModule != null) + if (CVRInputManager._moduleXR._leftModule is CVRXRModule_SteamVR leftModule) leftModule._steamVr = null; + + if (CVRInputManager._moduleXR._rightModule != null) + if (CVRInputManager._moduleXR._rightModule is CVRXRModule_SteamVR rightModule) rightModule._steamVr = null; + + // TODO: MOVE THIS TO DIFFERENT TRACKER + RootLogic.Instance.ToggleMouse(args.IsUsingVr); + //just in case CVRInputManager.Instance.textInputFocused = false; //sometimes head can get stuck, so just in case