[DesktopVRIK] Fixes for 2023r172.

This commit is contained in:
NotAKidoS 2023-09-23 18:58:43 -05:00
parent c7eb5715ba
commit df53840a63
6 changed files with 27 additions and 13 deletions

View file

@ -111,7 +111,7 @@ internal class PlayerSetupPatches
return; return;
CVRMovementParent currentParent = __instance._movementSystem._currentParent; CVRMovementParent currentParent = __instance._movementSystem._currentParent;
__runOriginal = currentParent?._referencePoint != null __runOriginal = (currentParent != null && currentParent._referencePoint != null)
? IKManager.Instance.OnPlayerHandleMovementParent(currentParent) ? IKManager.Instance.OnPlayerHandleMovementParent(currentParent)
: IKManager.Instance.OnPlayerTeleported(); : IKManager.Instance.OnPlayerTeleported();
} }

View file

@ -48,12 +48,15 @@ internal abstract class IKHandler
{ {
Vector3 currentPosition = currentParent._referencePoint.position; Vector3 currentPosition = currentParent._referencePoint.position;
Quaternion currentRotation = Quaternion.Euler(0f, currentParent.transform.rotation.eulerAngles.y, 0f); Quaternion currentRotation = Quaternion.Euler(0f, currentParent.transform.rotation.eulerAngles.y, 0f);
Vector3 deltaPosition = currentPosition - _movementPosition; if (_movementParent != null && _movementParent == currentParent)
Quaternion deltaRotation = Quaternion.Inverse(_movementRotation) * currentRotation;
if (_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); _solver.AddPlatformMotion(deltaPosition, deltaRotation, platformPivot);
_ikSimulatedRootAngle = Mathf.Repeat(_ikSimulatedRootAngle + deltaRotation.eulerAngles.y, 360f); _ikSimulatedRootAngle = Mathf.Repeat(_ikSimulatedRootAngle + deltaRotation.eulerAngles.y, 360f);
} }

View file

@ -26,7 +26,6 @@ public class IKManager : MonoBehaviour
// Player Info // Player Info
internal Transform _desktopCamera; internal Transform _desktopCamera;
internal Transform _vrCamera; internal Transform _vrCamera;
private bool _isEmotePlaying;
// Avatar Info // Avatar Info
private Animator _animator; private Animator _animator;

View file

@ -28,6 +28,6 @@ using System.Reflection;
namespace NAK.DesktopVRIK.Properties; namespace NAK.DesktopVRIK.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "4.2.5"; public const string Version = "4.2.6";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }

View file

@ -1,8 +1,8 @@
{ {
"_id": 117, "_id": 117,
"name": "DesktopVRIK", "name": "DesktopVRIK",
"modversion": "4.2.5", "modversion": "4.2.6",
"gameversion": "2023r171", "gameversion": "2023r172",
"loaderversion": "0.6.1", "loaderversion": "0.6.1",
"modtype": "Mod", "modtype": "Mod",
"author": "NotAKidoS", "author": "NotAKidoS",
@ -17,8 +17,8 @@
"requirements": [ "requirements": [
"BTKUILib" "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/", "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" "embedcolor": "#9b59b6"
} }

View file

@ -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.InputModules;
using ABI_RC.Systems.InputManagement.XR.Modules;
namespace NAK.DesktopVRSwitch.VRModeTrackers; namespace NAK.DesktopVRSwitch.VRModeTrackers;
@ -24,6 +26,16 @@ public class CVRInputManagerTracker : VRModeTracker
// IM CRYING // IM CRYING
//CVRInputManager.Instance.reload = true; //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 //just in case
CVRInputManager.Instance.textInputFocused = false; CVRInputManager.Instance.textInputFocused = false;
//sometimes head can get stuck, so just in case //sometimes head can get stuck, so just in case