From b0ae6082bf711adf1f057f619fdae91141b2fcfa Mon Sep 17 00:00:00 2001 From: SDraw Date: Tue, 14 Feb 2023 21:31:07 +0300 Subject: [PATCH 01/11] Convert to 2023r171ex1 --- ml_amt/Properties/AssemblyInfo.cs | 8 +- ml_amt/ml_amt.csproj | 151 ++++++++++------------ ml_amt/ml_amt.csproj.user | 6 - ml_dht/Properties/AssemblyInfo.cs | 8 +- ml_dht/ml_dht.csproj | 146 +++++++++------------ ml_dht/ml_dht.csproj.user | 6 - ml_egn/Properties/AssemblyInfo.cs | 8 +- ml_egn/ml_egn.csproj | 115 +++++++---------- ml_egn/ml_egn.csproj.user | 6 - ml_lme/LeapInput.cs | 18 +-- ml_lme/Properties/AssemblyInfo.cs | 8 +- ml_lme/Utils.cs | 45 ++++--- ml_lme/ml_lme.csproj | 205 +++++++++++------------------- ml_lme/ml_lme.csproj.user | 6 - ml_mods_cvr.sln | 58 ++++----- ml_pam/Properties/AssemblyInfo.cs | 8 +- ml_pam/ml_pam.csproj | 144 +++++++++------------ ml_pam/ml_pam.csproj.user | 6 - 18 files changed, 371 insertions(+), 581 deletions(-) delete mode 100644 ml_amt/ml_amt.csproj.user delete mode 100644 ml_dht/ml_dht.csproj.user delete mode 100644 ml_egn/ml_egn.csproj.user delete mode 100644 ml_lme/ml_lme.csproj.user delete mode 100644 ml_pam/ml_pam.csproj.user diff --git a/ml_amt/Properties/AssemblyInfo.cs b/ml_amt/Properties/AssemblyInfo.cs index 1bbc069..eaafb9a 100644 --- a/ml_amt/Properties/AssemblyInfo.cs +++ b/ml_amt/Properties/AssemblyInfo.cs @@ -1,10 +1,4 @@ -using System.Reflection; - -[assembly: AssemblyTitle("AvatarMotionTweaker")] -[assembly: AssemblyVersion("1.2.3")] -[assembly: AssemblyFileVersion("1.2.3")] - -[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.2.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.2.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_amt/ml_amt.csproj b/ml_amt/ml_amt.csproj index bea6a67..488cd77 100644 --- a/ml_amt/ml_amt.csproj +++ b/ml_amt/ml_amt.csproj @@ -1,93 +1,78 @@ - - - + + - Debug - AnyCPU - {74E13D02-A506-41A2-A2CF-C8B3D5B1E452} - Library - Properties - ml_amt + netstandard2.1 + SDraw + None + AvatarMotionTweaker + AvatarMotionTweaker + 1.2.3 + x64 ml_amt - v4.7.2 - 512 - true - - true - bin\x64\Debug\ - DEBUG;TRACE - full + + x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset + 4 + none + false + - - False - - - False - False - - - False - C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll - False - - - False - - - False - - - False - False - - - - - - - - - - False - False - - - False - - - False - D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.PhysicsModule.dll - False - - - - - - - - - - + + + - - - copy /y "$(TargetPath)" "D:\Games\Steam\steamapps\common\ChilloutVR\Mods\" - - \ No newline at end of file + + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll + false + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.PhysicsModule.dll + false + + + + + + + + diff --git a/ml_amt/ml_amt.csproj.user b/ml_amt/ml_amt.csproj.user deleted file mode 100644 index 04df561..0000000 --- a/ml_amt/ml_amt.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\;D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\ - - \ No newline at end of file diff --git a/ml_dht/Properties/AssemblyInfo.cs b/ml_dht/Properties/AssemblyInfo.cs index 8ec9bbb..84eafec 100644 --- a/ml_dht/Properties/AssemblyInfo.cs +++ b/ml_dht/Properties/AssemblyInfo.cs @@ -1,10 +1,4 @@ -using System.Reflection; - -[assembly: AssemblyTitle("DesktopHeadTracking")] -[assembly: AssemblyVersion("1.1.1")] -[assembly: AssemblyFileVersion("1.1.1")] - -[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.1.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.1.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_dht/ml_dht.csproj b/ml_dht/ml_dht.csproj index 5093a18..c180073 100644 --- a/ml_dht/ml_dht.csproj +++ b/ml_dht/ml_dht.csproj @@ -1,93 +1,71 @@ - - - + + - Debug - AnyCPU - {6DD89FC3-A974-4C39-A3EE-F60C24B17B5B} - Library - Properties - ml_dht - ml_dht - v4.7.2 - 512 - true + netstandard2.1 + DesktopHeadTracking + SDraw + None + DesktopHeadTracking + 1.1.1 + x64 - - true - bin\x64\Debug\ - DEBUG;TRACE - full + + x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset + none + false + - - False - False - - - False - False - - - False - C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll - False - - - C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll - False - - - C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll - False - - - C:\Games\Steam\common\ChilloutVR\MelonLoader\MelonLoader.dll - False - - - - - - - - - - False - False - - - False - + + - - - - - - - - - - - + - - - copy /y "$(TargetPath)" "D:\Games\Steam\steamapps\common\ChilloutVR\Mods\" - - \ No newline at end of file + + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false + + + + + + + + diff --git a/ml_dht/ml_dht.csproj.user b/ml_dht/ml_dht.csproj.user deleted file mode 100644 index 04df561..0000000 --- a/ml_dht/ml_dht.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\;D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\ - - \ No newline at end of file diff --git a/ml_egn/Properties/AssemblyInfo.cs b/ml_egn/Properties/AssemblyInfo.cs index f1610b5..81075ea 100644 --- a/ml_egn/Properties/AssemblyInfo.cs +++ b/ml_egn/Properties/AssemblyInfo.cs @@ -1,10 +1,4 @@ -using System.Reflection; - -[assembly: AssemblyTitle("ExtendedGameNotifications")] -[assembly: AssemblyVersion("1.0.1")] -[assembly: AssemblyFileVersion("1.0.1")] - -[assembly: MelonLoader.MelonInfo(typeof(ml_egn.ExtendedGameNotifications), "ExtendedGameNotifications", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_egn.ExtendedGameNotifications), "ExtendedGameNotifications", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_egn/ml_egn.csproj b/ml_egn/ml_egn.csproj index d3728e6..1bde6ae 100644 --- a/ml_egn/ml_egn.csproj +++ b/ml_egn/ml_egn.csproj @@ -1,82 +1,57 @@ - - - + + - Debug - AnyCPU - {1B5ACA07-6266-4C9A-BA30-D4BBE6634846} - Library - Properties - ml_egn - ml_egn - v4.7.2 - 512 - true + netstandard2.1 + x64 + ExtendedGameNotifications + 1.0.1 + SDraw + None + ExtendedGameNotifications - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset + + + none + false + - - False - F:\games\Steam\common\ChilloutVR\MelonLoader\0Harmony.dll - False + + + + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll + false - - False - F:\games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll - False + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll + false - False + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\DarkRift.dll + false - - False - False + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\DarkRift.Client.dll + false - - False - F:\games\Steam\common\ChilloutVR\MelonLoader\MelonLoader.dll - False + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll + false - - - - - - - - - False - False + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false - - - - - - - - - - - - copy /y "$(TargetPath)" "D:\Games\Steam\steamapps\common\ChilloutVR\Mods\" - - \ No newline at end of file + + + + + + diff --git a/ml_egn/ml_egn.csproj.user b/ml_egn/ml_egn.csproj.user deleted file mode 100644 index 04df561..0000000 --- a/ml_egn/ml_egn.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\;D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\ - - \ No newline at end of file diff --git a/ml_lme/LeapInput.cs b/ml_lme/LeapInput.cs index 697d95e..2affd0a 100644 --- a/ml_lme/LeapInput.cs +++ b/ml_lme/LeapInput.cs @@ -11,10 +11,10 @@ namespace ml_lme [DisallowMultipleComponent] class LeapInput : CVRInputModule { - static readonly FieldInfo ms_indexGestureToggle = typeof(InputModuleSteamVR).GetField("_steamVrIndexGestureToggleValue", BindingFlags.Instance | BindingFlags.NonPublic); + static readonly FieldInfo ms_indexGestureToggle = typeof(InputModuleOpenXR).GetField("_steamVrIndexGestureToggleValue", BindingFlags.Instance | BindingFlags.NonPublic); CVRInputManager m_inputManager = null; - InputModuleSteamVR m_steamVrModule = null; + InputModuleOpenXR m_openXrModule = null; bool m_inVR = false; bool m_gripToGrab = true; @@ -32,7 +32,7 @@ namespace ml_lme base.Start(); m_inputManager = CVRInputManager.Instance; // _inputManager is stripped out, cool beans - m_steamVrModule = m_inputManager.GetComponent(); + m_openXrModule = m_inputManager.GetComponent(); m_inVR = Utils.IsInVR(); m_handRayLeft = LeapTracking.GetInstance().GetLeftHand().gameObject.AddComponent(); @@ -240,7 +240,7 @@ namespace ml_lme // Arbitrary void UpdateFingerTracking() { - m_inputManager.individualFingerTracking = (Settings.Enabled || (m_inVR && Utils.AreKnucklesInUse() && !(bool)ms_indexGestureToggle.GetValue(m_steamVrModule))); + m_inputManager.individualFingerTracking = (Settings.Enabled || (m_inVR && m_openXrModule.AreKnucklesInUse() && !(bool)ms_indexGestureToggle.GetValue(m_openXrModule))); IKSystem.Instance.FingerSystem.controlActive = m_inputManager.individualFingerTracking; } @@ -256,11 +256,6 @@ namespace ml_lme m_inputManager.fingerCurlLeftMiddle = p_hand.m_bends[2]; m_inputManager.fingerCurlLeftRing = p_hand.m_bends[3]; m_inputManager.fingerCurlLeftPinky = p_hand.m_bends[4]; - IKSystem.Instance.FingerSystem.leftThumbCurl = p_hand.m_bends[0]; - IKSystem.Instance.FingerSystem.leftIndexCurl = p_hand.m_bends[1]; - IKSystem.Instance.FingerSystem.leftMiddleCurl = p_hand.m_bends[2]; - IKSystem.Instance.FingerSystem.leftRingCurl = p_hand.m_bends[3]; - IKSystem.Instance.FingerSystem.leftPinkyCurl = p_hand.m_bends[4]; } else { @@ -269,11 +264,6 @@ namespace ml_lme m_inputManager.fingerCurlRightMiddle = p_hand.m_bends[2]; m_inputManager.fingerCurlRightRing = p_hand.m_bends[3]; m_inputManager.fingerCurlRightPinky = p_hand.m_bends[4]; - IKSystem.Instance.FingerSystem.rightThumbCurl = p_hand.m_bends[0]; - IKSystem.Instance.FingerSystem.rightIndexCurl = p_hand.m_bends[1]; - IKSystem.Instance.FingerSystem.rightMiddleCurl = p_hand.m_bends[2]; - IKSystem.Instance.FingerSystem.rightRingCurl = p_hand.m_bends[3]; - IKSystem.Instance.FingerSystem.rightPinkyCurl = p_hand.m_bends[4]; } } diff --git a/ml_lme/Properties/AssemblyInfo.cs b/ml_lme/Properties/AssemblyInfo.cs index c404034..2ba92f2 100644 --- a/ml_lme/Properties/AssemblyInfo.cs +++ b/ml_lme/Properties/AssemblyInfo.cs @@ -1,10 +1,4 @@ -using System.Reflection; - -[assembly: AssemblyTitle("LeapMotionExtension")] -[assembly: AssemblyVersion("1.3.1")] -[assembly: AssemblyFileVersion("1.3.1")] - -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_lme/Utils.cs b/ml_lme/Utils.cs index a113e64..26bb9b8 100644 --- a/ml_lme/Utils.cs +++ b/ml_lme/Utils.cs @@ -1,7 +1,8 @@ -using ABI_RC.Core.Player; +using ABI_RC.Core.Savior; using ABI_RC.Core.UI; -using System.Linq; +using System.Reflection; using UnityEngine; +using UnityEngine.XR; namespace ml_lme { @@ -9,11 +10,13 @@ namespace ml_lme { static readonly Quaternion ms_hmdRotationFix = new Quaternion(0f, 0.7071068f, 0.7071068f, 0f); static readonly Quaternion ms_screentopRotationFix = new Quaternion(0f, 0f, -1f, 0f); + static readonly FieldInfo ms_leftControllerName = typeof(InputModuleOpenXR).GetField("_leftHandControllerName", BindingFlags.NonPublic | BindingFlags.Instance); + static readonly FieldInfo ms_rightControllerName = typeof(InputModuleOpenXR).GetField("_rightHandControllerName", BindingFlags.NonPublic | BindingFlags.Instance); - public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded); - public static bool AreKnucklesInUse() => PlayerSetup.Instance._trackerManager.trackerNames.Contains("knuckles"); - public static bool IsLeftHandTracked() => ((VRTrackerManager.Instance.leftHand != null) && VRTrackerManager.Instance.leftHand.active); - public static bool IsRightHandTracked() => ((VRTrackerManager.Instance.rightHand != null) && VRTrackerManager.Instance.rightHand.active); + public static bool IsInVR() => ((CheckVR.Instance != null) && CheckVR.Instance.hasVrDeviceLoaded); + public static bool AreKnucklesInUse(this InputModuleOpenXR p_module) => (((string)ms_leftControllerName.GetValue(p_module)).Contains("Index") || ((string)ms_rightControllerName.GetValue(p_module)).Contains("Index")); + public static bool IsLeftHandTracked() => InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).isValid; + public static bool IsRightHandTracked() => InputDevices.GetDeviceAtXRNode(XRNode.RightHand).isValid; public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false) { @@ -22,9 +25,9 @@ namespace ml_lme public static void ShowHUDNotification(string p_title, string p_message, string p_small = "", bool p_immediate = false) { - if(CohtmlHud.Instance != null) + if (CohtmlHud.Instance != null) { - if(p_immediate) + if (p_immediate) CohtmlHud.Instance.ViewDropTextImmediate(p_title, p_message, p_small); else CohtmlHud.Instance.ViewDropText(p_title, p_message, p_small); @@ -38,23 +41,23 @@ namespace ml_lme p_rot.x *= -1f; p_rot.y *= -1f; - switch(p_mode) + switch (p_mode) { case Settings.LeapTrackingMode.Screentop: - { - p_pos.x *= -1f; - p_pos.y *= -1f; - p_rot = (ms_screentopRotationFix * p_rot); - } - break; + { + p_pos.x *= -1f; + p_pos.y *= -1f; + p_rot = (ms_screentopRotationFix * p_rot); + } + break; case Settings.LeapTrackingMode.HMD: - { - p_pos.x *= -1f; - Swap(ref p_pos.y, ref p_pos.z); - p_rot = (ms_hmdRotationFix * p_rot); - } - break; + { + p_pos.x *= -1f; + Swap(ref p_pos.y, ref p_pos.z); + p_rot = (ms_hmdRotationFix * p_rot); + } + break; } } diff --git a/ml_lme/ml_lme.csproj b/ml_lme/ml_lme.csproj index 25fb3c8..9ee47f9 100644 --- a/ml_lme/ml_lme.csproj +++ b/ml_lme/ml_lme.csproj @@ -1,144 +1,89 @@ - - - + + - Debug - AnyCPU - {83CC74B7-F444-40E1-BD06-67CEC995A919} - Library - Properties - ml_lme - ml_lme - v4.7.2 - 512 - true + netstandard2.1 + x64 + LeapMotionExtension + 1.3.1 + SDraw + None + LeapMotionExtension - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset + + + none + false + - - False - C:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll - False - - - C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll - False - - - C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll - False - - - False - - - False - - - C:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll - False - - - - - - - - - - C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll - False - - - C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll - False - - - False - C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AssetBundleModule.dll - False - - - C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll - False - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + LeapC.dll + - + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AssetBundleModule.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.XRModule.dll + false + - - - - - - copy /y "$(TargetPath)" "D:\Games\Steam\steamapps\common\ChilloutVR\Mods\" - - \ No newline at end of file + + + + + + diff --git a/ml_lme/ml_lme.csproj.user b/ml_lme/ml_lme.csproj.user deleted file mode 100644 index 04df561..0000000 --- a/ml_lme/ml_lme.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\;D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\ - - \ No newline at end of file diff --git a/ml_mods_cvr.sln b/ml_mods_cvr.sln index d9193c5..ecbbad0 100644 --- a/ml_mods_cvr.sln +++ b/ml_mods_cvr.sln @@ -1,19 +1,19 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.1738 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33214.272 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_lme", "ml_lme\ml_lme.csproj", "{83CC74B7-F444-40E1-BD06-67CEC995A919}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_amt", "ml_amt\ml_amt.csproj", "{714806A3-E6FC-46F6-9D1D-89C77FEBAF06}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_drs", "ml_drs\ml_drs.csproj", "{06CD5155-4459-48C3-8A53-E0B91136351B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_dht", "ml_dht\ml_dht.csproj", "{D805BA67-067E-4B79-87FC-6B08973F13EE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_amt", "ml_amt\ml_amt.csproj", "{74E13D02-A506-41A2-A2CF-C8B3D5B1E452}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_drs", "ml_drs\ml_drs.csproj", "{47B2BE27-B238-4135-AE17-9195884FDD8F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_dht", "ml_dht\ml_dht.csproj", "{6DD89FC3-A974-4C39-A3EE-F60C24B17B5B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_egn", "ml_egn\ml_egn.csproj", "{8B05FAC0-5C12-40CA-BA48-9F55923E8135}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_egn", "ml_egn\ml_egn.csproj", "{1B5ACA07-6266-4C9A-BA30-D4BBE6634846}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_lme", "ml_lme\ml_lme.csproj", "{77EA76B1-3709-4FC5-BDBD-8F77160E6DA3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_pam", "ml_pam\ml_pam.csproj", "{3B5028DE-8C79-40DF-A1EF-BDB29D366125}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_pam", "ml_pam\ml_pam.csproj", "{5B614459-234A-443D-B06D-34FF81ADA67E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,30 +21,24 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {83CC74B7-F444-40E1-BD06-67CEC995A919}.Debug|x64.ActiveCfg = Debug|x64 - {83CC74B7-F444-40E1-BD06-67CEC995A919}.Debug|x64.Build.0 = Debug|x64 - {83CC74B7-F444-40E1-BD06-67CEC995A919}.Release|x64.ActiveCfg = Release|x64 - {83CC74B7-F444-40E1-BD06-67CEC995A919}.Release|x64.Build.0 = Release|x64 - {06CD5155-4459-48C3-8A53-E0B91136351B}.Debug|x64.ActiveCfg = Debug|x64 - {06CD5155-4459-48C3-8A53-E0B91136351B}.Debug|x64.Build.0 = Debug|x64 - {06CD5155-4459-48C3-8A53-E0B91136351B}.Release|x64.ActiveCfg = Release|x64 - {06CD5155-4459-48C3-8A53-E0B91136351B}.Release|x64.Build.0 = Release|x64 - {74E13D02-A506-41A2-A2CF-C8B3D5B1E452}.Debug|x64.ActiveCfg = Debug|x64 - {74E13D02-A506-41A2-A2CF-C8B3D5B1E452}.Debug|x64.Build.0 = Debug|x64 - {74E13D02-A506-41A2-A2CF-C8B3D5B1E452}.Release|x64.ActiveCfg = Release|x64 - {74E13D02-A506-41A2-A2CF-C8B3D5B1E452}.Release|x64.Build.0 = Release|x64 - {6DD89FC3-A974-4C39-A3EE-F60C24B17B5B}.Debug|x64.ActiveCfg = Debug|x64 - {6DD89FC3-A974-4C39-A3EE-F60C24B17B5B}.Debug|x64.Build.0 = Debug|x64 - {6DD89FC3-A974-4C39-A3EE-F60C24B17B5B}.Release|x64.ActiveCfg = Release|x64 - {6DD89FC3-A974-4C39-A3EE-F60C24B17B5B}.Release|x64.Build.0 = Release|x64 - {1B5ACA07-6266-4C9A-BA30-D4BBE6634846}.Debug|x64.ActiveCfg = Debug|x64 - {1B5ACA07-6266-4C9A-BA30-D4BBE6634846}.Debug|x64.Build.0 = Debug|x64 - {1B5ACA07-6266-4C9A-BA30-D4BBE6634846}.Release|x64.ActiveCfg = Release|x64 - {1B5ACA07-6266-4C9A-BA30-D4BBE6634846}.Release|x64.Build.0 = Release|x64 - {3B5028DE-8C79-40DF-A1EF-BDB29D366125}.Debug|x64.ActiveCfg = Debug|x64 - {3B5028DE-8C79-40DF-A1EF-BDB29D366125}.Debug|x64.Build.0 = Debug|x64 - {3B5028DE-8C79-40DF-A1EF-BDB29D366125}.Release|x64.ActiveCfg = Release|x64 - {3B5028DE-8C79-40DF-A1EF-BDB29D366125}.Release|x64.Build.0 = Release|x64 + {714806A3-E6FC-46F6-9D1D-89C77FEBAF06}.Debug|x64.ActiveCfg = Debug|x64 + {714806A3-E6FC-46F6-9D1D-89C77FEBAF06}.Release|x64.ActiveCfg = Release|x64 + {714806A3-E6FC-46F6-9D1D-89C77FEBAF06}.Release|x64.Build.0 = Release|x64 + {D805BA67-067E-4B79-87FC-6B08973F13EE}.Debug|x64.ActiveCfg = Debug|x64 + {D805BA67-067E-4B79-87FC-6B08973F13EE}.Release|x64.ActiveCfg = Release|x64 + {D805BA67-067E-4B79-87FC-6B08973F13EE}.Release|x64.Build.0 = Release|x64 + {47B2BE27-B238-4135-AE17-9195884FDD8F}.Debug|x64.ActiveCfg = Debug|x64 + {47B2BE27-B238-4135-AE17-9195884FDD8F}.Release|x64.ActiveCfg = Release|x64 + {47B2BE27-B238-4135-AE17-9195884FDD8F}.Release|x64.Build.0 = Release|x64 + {8B05FAC0-5C12-40CA-BA48-9F55923E8135}.Debug|x64.ActiveCfg = Debug|x64 + {8B05FAC0-5C12-40CA-BA48-9F55923E8135}.Release|x64.ActiveCfg = Release|x64 + {8B05FAC0-5C12-40CA-BA48-9F55923E8135}.Release|x64.Build.0 = Release|x64 + {77EA76B1-3709-4FC5-BDBD-8F77160E6DA3}.Debug|x64.ActiveCfg = Debug|x64 + {77EA76B1-3709-4FC5-BDBD-8F77160E6DA3}.Release|x64.ActiveCfg = Release|x64 + {77EA76B1-3709-4FC5-BDBD-8F77160E6DA3}.Release|x64.Build.0 = Release|x64 + {5B614459-234A-443D-B06D-34FF81ADA67E}.Debug|x64.ActiveCfg = Debug|x64 + {5B614459-234A-443D-B06D-34FF81ADA67E}.Release|x64.ActiveCfg = Release|x64 + {5B614459-234A-443D-B06D-34FF81ADA67E}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ml_pam/Properties/AssemblyInfo.cs b/ml_pam/Properties/AssemblyInfo.cs index 9a229fb..45107f1 100644 --- a/ml_pam/Properties/AssemblyInfo.cs +++ b/ml_pam/Properties/AssemblyInfo.cs @@ -1,10 +1,4 @@ -using System.Reflection; - -[assembly: AssemblyTitle("PickupArmMovement")] -[assembly: AssemblyVersion("1.0.1")] -[assembly: AssemblyFileVersion("1.0.1")] - -[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPriority(1)] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] diff --git a/ml_pam/ml_pam.csproj b/ml_pam/ml_pam.csproj index 7250d1e..a591cc9 100644 --- a/ml_pam/ml_pam.csproj +++ b/ml_pam/ml_pam.csproj @@ -1,90 +1,70 @@ - - - + + - Debug - AnyCPU - {3B5028DE-8C79-40DF-A1EF-BDB29D366125} - Library - Properties - ml_pam - ml_pam - v4.7.2 - 512 - true + netstandard2.1 + x64 + PickupArmMovement + 1.0.1 + SDraw + None + PickupArmMovement - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset + + + none + false + - - False - D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll - False - - - False - D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll - False - - - False - False - - - False - - - False - - - False - D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll - False - - - - - - - - - - False - - - False - False - - - - - - - - - + + + - - - copy /y "$(TargetPath)" "D:\Games\Steam\steamapps\common\ChilloutVR\Mods\" - - \ No newline at end of file + + + + D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false + + + + + + + + diff --git a/ml_pam/ml_pam.csproj.user b/ml_pam/ml_pam.csproj.user deleted file mode 100644 index 04df561..0000000 --- a/ml_pam/ml_pam.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\;D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\ - - \ No newline at end of file From 268fec558ff9e3f5a7dde77a9edc1026873080ab Mon Sep 17 00:00:00 2001 From: SDraw Date: Thu, 16 Feb 2023 01:44:12 +0300 Subject: [PATCH 02/11] Locomotion center according to avatar scale --- ml_amt/Main.cs | 19 +++++++++++++++++++ ml_amt/MotionTweaker.cs | 18 +++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/ml_amt/Main.cs b/ml_amt/Main.cs index c6aeae2..4b6f999 100644 --- a/ml_amt/Main.cs +++ b/ml_amt/Main.cs @@ -47,6 +47,11 @@ namespace ml_amt null, new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnCalibrate_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) ); + HarmonyInstance.Patch( + typeof(PlayerSetup).GetMethod("SetPlaySpaceScale", BindingFlags.NonPublic | BindingFlags.Instance), + null, + new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) + ); // FBT detour HarmonyInstance.Patch( @@ -153,6 +158,20 @@ namespace ml_amt } } + static void OnPlayspaceScale_Postfix() => ms_instance?.OnPlayspaceScale(); + void OnPlayspaceScale() + { + try + { + if(m_localTweaker != null) + m_localTweaker.OnPlayspaceScale(); + } + catch(System.Exception l_exception) + { + MelonLoader.MelonLogger.Error(l_exception); + } + } + // FBT detection override static void FBTDetour_Prefix() { diff --git a/ml_amt/MotionTweaker.cs b/ml_amt/MotionTweaker.cs index 6d45664..52e70d0 100644 --- a/ml_amt/MotionTweaker.cs +++ b/ml_amt/MotionTweaker.cs @@ -116,8 +116,7 @@ namespace ml_amt // Update upright Matrix4x4 l_hmdMatrix = PlayerSetup.Instance.transform.GetMatrix().inverse * (m_inVR ? PlayerSetup.Instance.vrHeadTracker.transform.GetMatrix() : PlayerSetup.Instance.desktopCameraRig.transform.GetMatrix()); float l_currentHeight = Mathf.Clamp((l_hmdMatrix * ms_pointVector).y, 0f, float.MaxValue); - float l_avatarScale = (m_avatarScale > 0f) ? (PlayerSetup.Instance._avatar.transform.localScale.y / m_avatarScale) : 0f; - float l_avatarViewHeight = Mathf.Clamp(m_viewPointHeight * l_avatarScale, 0f, float.MaxValue); + float l_avatarViewHeight = Mathf.Clamp(m_viewPointHeight * GetRelativeScale(), 0f, float.MaxValue); m_upright = Mathf.Clamp01((l_avatarViewHeight > 0f) ? (l_currentHeight / l_avatarViewHeight) : 0f); m_poseState = (m_upright <= Mathf.Min(m_proneLimit, m_crouchLimit)) ? PoseState.Proning : ((m_upright <= Mathf.Max(m_proneLimit, m_crouchLimit)) ? PoseState.Crouching : PoseState.Standing); @@ -273,6 +272,14 @@ namespace ml_amt } } + internal void OnPlayspaceScale() + { + if((m_vrIk != null) && Settings.MassCenter) + { + m_vrIk.solver.locomotion.offset = m_massCenter * GetRelativeScale(); + } + } + void OnIKPreUpdate() { bool l_legsOverride = false; @@ -383,7 +390,12 @@ namespace ml_amt public void SetMassCenter(bool p_state) { if(m_vrIk != null) - m_vrIk.solver.locomotion.offset = (Settings.MassCenter ? m_massCenter : m_locomotionOffset); + m_vrIk.solver.locomotion.offset = (Settings.MassCenter ? (m_massCenter * GetRelativeScale()) : m_locomotionOffset); + } + + float GetRelativeScale() + { + return ((m_avatarScale > 0f) ? (PlayerSetup.Instance._avatar.transform.localScale.y / m_avatarScale) : 0f); } public float GetUpright() => m_upright; From 98af853aa06854d38d3f45e51ae7da6eb5e98a08 Mon Sep 17 00:00:00 2001 From: SDraw Date: Sat, 18 Feb 2023 08:59:47 +0300 Subject: [PATCH 03/11] Ignoring FBT for IK tweaking --- ml_amt/MotionTweaker.cs | 41 ++++++++++++++++++++++------------------- ml_amt/ml_amt.csproj | 4 ++++ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/ml_amt/MotionTweaker.cs b/ml_amt/MotionTweaker.cs index 52e70d0..3debec3 100644 --- a/ml_amt/MotionTweaker.cs +++ b/ml_amt/MotionTweaker.cs @@ -293,29 +293,32 @@ namespace ml_amt if(m_detectEmotes && m_emoteActive) m_vrIk.solver.IKPositionWeight = 0f; - if((m_ikOverrideCrouch && (m_poseState != PoseState.Standing)) || (m_ikOverrideProne && (m_poseState == PoseState.Proning))) + if(!BodySystem.isCalibratedAsFullBody) { - m_vrIk.solver.locomotion.weight = 0f; - l_legsOverride = true; - } - if(m_ikOverrideFly && MovementSystem.Instance.flying) - { - m_vrIk.solver.locomotion.weight = 0f; - m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; - m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; - l_legsOverride = true; - } - - if(m_ikOverrideJump && !m_grounded && !MovementSystem.Instance.flying) - { - m_vrIk.solver.locomotion.weight = 0f; - m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; - m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; - l_legsOverride = true; + if((m_ikOverrideCrouch && (m_poseState != PoseState.Standing)) || (m_ikOverrideProne && (m_poseState == PoseState.Proning))) + { + m_vrIk.solver.locomotion.weight = 0f; + m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; + m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; + l_legsOverride = true; + } + if(m_ikOverrideFly && MovementSystem.Instance.flying) + { + m_vrIk.solver.locomotion.weight = 0f; + m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; + m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; + l_legsOverride = true; + } + if(m_ikOverrideJump && !m_grounded && !MovementSystem.Instance.flying) + { + m_vrIk.solver.locomotion.weight = 0f; + m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; + m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; + l_legsOverride = true; + } } bool l_solverActive = !Mathf.Approximately(m_vrIk.solver.IKPositionWeight, 0f); - if(l_legsOverride && l_solverActive && m_followHips && (!m_moving || (m_poseState == PoseState.Proning)) && m_inVR && !BodySystem.isCalibratedAsFullBody) { m_vrIk.solver.plantFeet = false; diff --git a/ml_amt/ml_amt.csproj b/ml_amt/ml_amt.csproj index 488cd77..50899c6 100644 --- a/ml_amt/ml_amt.csproj +++ b/ml_amt/ml_amt.csproj @@ -18,6 +18,10 @@ false + + + + From 3940802858d00a2e06c09d1e28ecd917a7ee2e0b Mon Sep 17 00:00:00 2001 From: SDraw Date: Sat, 25 Feb 2023 12:34:42 +0300 Subject: [PATCH 04/11] IK reset after locomotion override --- ml_amt/MotionTweaker.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ml_amt/MotionTweaker.cs b/ml_amt/MotionTweaker.cs index 3debec3..79247eb 100644 --- a/ml_amt/MotionTweaker.cs +++ b/ml_amt/MotionTweaker.cs @@ -44,6 +44,7 @@ namespace ml_amt bool m_grounded = false; bool m_groundedRaw = false; bool m_moving = false; + bool m_locomotionOverride = false; bool m_ikOverrideCrouch = true; float m_crouchLimit = 0.65f; @@ -177,6 +178,7 @@ namespace ml_amt m_locomotionOffset = Vector3.zero; m_emoteActive = false; m_moving = false; + m_locomotionOverride = false; m_hipsToPlayer = Vector3.zero; m_avatarHips = null; m_viewPointHeight = 1f; @@ -282,7 +284,7 @@ namespace ml_amt void OnIKPreUpdate() { - bool l_legsOverride = false; + bool l_locomotionOverride = false; m_ikWeight = m_vrIk.solver.IKPositionWeight; m_locomotionWeight = m_vrIk.solver.locomotion.weight; @@ -300,31 +302,35 @@ namespace ml_amt m_vrIk.solver.locomotion.weight = 0f; m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; - l_legsOverride = true; + l_locomotionOverride = true; } if(m_ikOverrideFly && MovementSystem.Instance.flying) { m_vrIk.solver.locomotion.weight = 0f; m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; - l_legsOverride = true; + l_locomotionOverride = true; } if(m_ikOverrideJump && !m_grounded && !MovementSystem.Instance.flying) { m_vrIk.solver.locomotion.weight = 0f; m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; - l_legsOverride = true; + l_locomotionOverride = true; } } bool l_solverActive = !Mathf.Approximately(m_vrIk.solver.IKPositionWeight, 0f); - if(l_legsOverride && l_solverActive && m_followHips && (!m_moving || (m_poseState == PoseState.Proning)) && m_inVR && !BodySystem.isCalibratedAsFullBody) + if(l_locomotionOverride && l_solverActive && m_followHips && (!m_moving || (m_poseState == PoseState.Proning)) && m_inVR && !BodySystem.isCalibratedAsFullBody) { m_vrIk.solver.plantFeet = false; ABI_RC.Systems.IK.IKSystem.VrikRootController.enabled = false; PlayerSetup.Instance._avatar.transform.localPosition = m_hipsToPlayer; } + + if(m_locomotionOverride && !l_locomotionOverride) + m_vrIk.solver.Reset(); + m_locomotionOverride = l_locomotionOverride; } void OnIKPostUpdate() From fc60219a4ecabf2eb90d71a47d57ba42bc8589db Mon Sep 17 00:00:00 2001 From: SDraw Date: Sun, 26 Feb 2023 21:49:51 +0300 Subject: [PATCH 05/11] Fully working animation override fix --- ml_amt/Main.cs | 49 +++++++++++++++++++++++++++++++--------- ml_amt/Settings.cs | 4 ++-- ml_amt/resources/menu.js | 4 ++-- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/ml_amt/Main.cs b/ml_amt/Main.cs index 4b6f999..3a1ea73 100644 --- a/ml_amt/Main.cs +++ b/ml_amt/Main.cs @@ -75,16 +75,16 @@ namespace ml_amt null ); - // AAS overriding "fix" + // AAS overriding fix HarmonyInstance.Patch( - typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.SetOverrideAnimation), BindingFlags.Instance), - new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnAnimationOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)), - null + typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.SetOverrideAnimation)), + new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)), + new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) ); HarmonyInstance.Patch( typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.RestoreOverrideAnimation)), - new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnAnimationOverrideRestore_Prefix), BindingFlags.Static | BindingFlags.NonPublic)), - null + new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)), + new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) ); MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer()); @@ -256,14 +256,41 @@ namespace ml_amt return false; } - static bool OnAnimationOverride_Prefix() + static void OnOverride_Prefix(ref CVRAnimatorManager __instance) { - return !Settings.OverrideFix; + try + { + if(Settings.OverrideFix) + { + if(__instance.animator != null) + { + __instance.animator.enabled = false; + __instance.animator.WriteDefaultValues(); + } + } + } + catch(System.Exception l_exception) + { + MelonLoader.MelonLogger.Error(l_exception); + } } - - static bool OnAnimationOverrideRestore_Prefix() + static void OnOverride_Postfix(ref CVRAnimatorManager __instance) { - return !Settings.OverrideFix; + try + { + if(Settings.OverrideFix) + { + if(__instance.animator != null) + { + __instance.animator.enabled = true; + __instance.animator.Update(0f); + } + } + } + catch(System.Exception l_exception) + { + MelonLoader.MelonLogger.Error(l_exception); + } } } } diff --git a/ml_amt/Settings.cs b/ml_amt/Settings.cs index c01f273..8a2cb9b 100644 --- a/ml_amt/Settings.cs +++ b/ml_amt/Settings.cs @@ -36,7 +36,7 @@ namespace ml_amt static bool ms_followHips = true; static bool ms_collisionScale = true; static bool ms_massCenter = true; - static bool ms_overrideFix = false; + static bool ms_overrideFix = true; static MelonLoader.MelonPreferences_Category ms_category = null; static List ms_entries = null; @@ -73,7 +73,7 @@ namespace ml_amt ms_category.CreateEntry(ModSetting.FollowHips.ToString(), true), ms_category.CreateEntry(ModSetting.CollisionScale.ToString(), true), ms_category.CreateEntry(ModSetting.MassCenter.ToString(), true), - ms_category.CreateEntry(ModSetting.OverrideFix.ToString(), false) + ms_category.CreateEntry(ModSetting.OverrideFix.ToString(), true) }; Load(); diff --git a/ml_amt/resources/menu.js b/ml_amt/resources/menu.js index 8e1e71c..9298fff 100644 --- a/ml_amt/resources/menu.js +++ b/ml_amt/resources/menu.js @@ -265,9 +265,9 @@ function inp_toggle_mod_amt(_obj, _callbackName) {
-
Prevent Unity animation override (chairs, etc.):
+
Fix animation overrides (chairs, etc.):
-
+
`; From 28aca1bb4925f8357ecdd1195402df400f0a31cc Mon Sep 17 00:00:00 2001 From: SDraw Date: Fri, 3 Mar 2023 00:44:17 +0300 Subject: [PATCH 06/11] Scaled locomotion steps Funny C# properties Minor fixes --- ml_amt/Main.cs | 20 ++-- ml_amt/MotionTweaker.cs | 71 +++++++++++--- ml_amt/Settings.cs | 207 ++++++++++++++++----------------------- ml_amt/Utils.cs | 9 +- ml_amt/resources/menu.js | 7 ++ ml_dht/HeadTracked.cs | 18 ++-- ml_dht/Settings.cs | 99 +++++++------------ ml_lme/LeapTracked.cs | 86 ++++++++-------- ml_lme/Settings.cs | 205 +++++++++++++++----------------------- ml_pam/ArmMover.cs | 2 + ml_pam/Settings.cs | 29 ++---- 11 files changed, 343 insertions(+), 410 deletions(-) diff --git a/ml_amt/Main.cs b/ml_amt/Main.cs index 3a1ea73..3999cb9 100644 --- a/ml_amt/Main.cs +++ b/ml_amt/Main.cs @@ -98,7 +98,7 @@ namespace ml_amt m_localTweaker = PlayerSetup.Instance.gameObject.AddComponent(); m_localTweaker.SetIKOverrideCrouch(Settings.IKOverrideCrouch); m_localTweaker.SetCrouchLimit(Settings.CrouchLimit); - m_localTweaker.SetIKOverrideCrouch(Settings.IKOverrideProne); + m_localTweaker.SetIKOverrideProne(Settings.IKOverrideProne); m_localTweaker.SetProneLimit(Settings.ProneLimit); m_localTweaker.SetPoseTransitions(Settings.PoseTransitions); m_localTweaker.SetAdjustedMovement(Settings.AdjustedMovement); @@ -260,13 +260,10 @@ namespace ml_amt { try { - if(Settings.OverrideFix) + if(Settings.OverrideFix && (__instance.animator != null)) { - if(__instance.animator != null) - { - __instance.animator.enabled = false; - __instance.animator.WriteDefaultValues(); - } + __instance.animator.enabled = false; + __instance.animator.WriteDefaultValues(); } } catch(System.Exception l_exception) @@ -278,13 +275,10 @@ namespace ml_amt { try { - if(Settings.OverrideFix) + if(Settings.OverrideFix && (__instance.animator != null)) { - if(__instance.animator != null) - { - __instance.animator.enabled = true; - __instance.animator.Update(0f); - } + __instance.animator.enabled = true; + __instance.animator.Update(0f); } } catch(System.Exception l_exception) diff --git a/ml_amt/MotionTweaker.cs b/ml_amt/MotionTweaker.cs index 79247eb..a0e7922 100644 --- a/ml_amt/MotionTweaker.cs +++ b/ml_amt/MotionTweaker.cs @@ -1,4 +1,5 @@ using ABI_RC.Core.Player; +using ABI_RC.Systems.IK; using ABI_RC.Systems.IK.SubSystems; using ABI_RC.Systems.MovementSystem; using RootMotion.FinalIK; @@ -65,6 +66,7 @@ namespace ml_amt bool m_followHips = true; Vector3 m_hipsToPlayer = Vector3.zero; + Vector2 m_stepDistance = Vector2.zero; Vector3 m_massCenter = Vector3.zero; readonly List m_parameters = null; @@ -74,6 +76,7 @@ namespace ml_amt m_parameters = new List(); } + // Unity events void Start() { m_inVR = Utils.IsInVR(); @@ -88,7 +91,8 @@ namespace ml_amt Settings.IKOverrideJumpChange += this.SetIKOverrideJump; Settings.DetectEmotesChange += this.SetDetectEmotes; Settings.FollowHipsChange += this.SetFollowHips; - Settings.MassCenterChange += this.SetMassCenter; + Settings.MassCenterChange += this.OnMassCenterChange; + Settings.ScaledStepsChange += this.OnScaledStepsChange; } void OnDestroy() @@ -103,7 +107,7 @@ namespace ml_amt Settings.IKOverrideJumpChange -= this.SetIKOverrideJump; Settings.DetectEmotesChange -= this.SetDetectEmotes; Settings.FollowHipsChange -= this.SetFollowHips; - Settings.MassCenterChange -= this.SetMassCenter; + Settings.MassCenterChange -= this.OnMassCenterChange; } void Update() @@ -163,6 +167,7 @@ namespace ml_amt } } + // Game events internal void OnAvatarClear() { m_vrIk = null; @@ -183,6 +188,7 @@ namespace ml_amt m_avatarHips = null; m_viewPointHeight = 1f; m_massCenter = Vector3.zero; + m_stepDistance = Vector2.zero; m_parameters.Clear(); } @@ -253,6 +259,8 @@ namespace ml_amt m_vrIk.solver.locomotion.offset = (Settings.MassCenter ? m_massCenter : m_locomotionOffset); + m_stepDistance.Set(m_vrIk.solver.locomotion.stepThreshold, m_vrIk.solver.locomotion.footDistance); + m_vrIk.onPreSolverUpdate.AddListener(this.OnIKPreUpdate); m_vrIk.onPostSolverUpdate.AddListener(this.OnIKPostUpdate); } @@ -276,12 +284,23 @@ namespace ml_amt internal void OnPlayspaceScale() { - if((m_vrIk != null) && Settings.MassCenter) + if(m_vrIk != null) { - m_vrIk.solver.locomotion.offset = m_massCenter * GetRelativeScale(); + if(Settings.MassCenter) + m_vrIk.solver.locomotion.offset = m_massCenter * GetRelativeScale(); + + if(Settings.ScaledSteps) + { + m_vrIk.solver.locomotion.stepThreshold = m_stepDistance.x * GetRelativeScale(); + m_vrIk.solver.locomotion.footDistance = m_stepDistance.y * GetRelativeScale(); + + m_vrIk.solver.locomotion.stepHeight.keys = Utils.GetSineKeyframes(Mathf.Clamp01(PlayerSetup.Instance.GetAvatarHeight()) * 0.03f); + m_vrIk.solver.locomotion.heelHeight.keys = Utils.GetSineKeyframes(Mathf.Clamp01(PlayerSetup.Instance.GetAvatarHeight()) * 0.03f); + } } } + // IK events void OnIKPreUpdate() { bool l_locomotionOverride = false; @@ -342,25 +361,26 @@ namespace ml_amt m_vrIk.solver.rightLeg.useAnimatedBendNormal = m_bendNormalRight; } - public void SetIKOverrideCrouch(bool p_state) + // Settings + internal void SetIKOverrideCrouch(bool p_state) { m_ikOverrideCrouch = p_state; } - public void SetCrouchLimit(float p_value) + internal void SetCrouchLimit(float p_value) { if(!m_customCrouchLimit) m_crouchLimit = Mathf.Clamp01(p_value); } - public void SetIKOverrideProne(bool p_state) + internal void SetIKOverrideProne(bool p_state) { m_ikOverrideProne = p_state; } - public void SetProneLimit(float p_value) + internal void SetProneLimit(float p_value) { if(!m_customProneLimit) m_proneLimit = Mathf.Clamp01(p_value); } - public void SetPoseTransitions(bool p_state) + internal void SetPoseTransitions(bool p_state) { m_poseTransitions = p_state; @@ -370,7 +390,7 @@ namespace ml_amt PlayerSetup.Instance.animatorManager.SetAnimatorParameterBool("Prone", false); } } - public void SetAdjustedMovement(bool p_state) + internal void SetAdjustedMovement(bool p_state) { m_adjustedMovement = p_state; @@ -380,33 +400,54 @@ namespace ml_amt MovementSystem.Instance.ChangeProne(false); } } - public void SetIKOverrideFly(bool p_state) + internal void SetIKOverrideFly(bool p_state) { m_ikOverrideFly = p_state; } - public void SetIKOverrideJump(bool p_state) + internal void SetIKOverrideJump(bool p_state) { m_ikOverrideJump = p_state; } - public void SetDetectEmotes(bool p_state) + internal void SetDetectEmotes(bool p_state) { m_detectEmotes = p_state; } - public void SetFollowHips(bool p_state) + internal void SetFollowHips(bool p_state) { m_followHips = p_state; } - public void SetMassCenter(bool p_state) + void OnMassCenterChange(bool p_state) { if(m_vrIk != null) m_vrIk.solver.locomotion.offset = (Settings.MassCenter ? (m_massCenter * GetRelativeScale()) : m_locomotionOffset); } + void OnScaledStepsChange(bool p_state) + { + if(m_vrIk != null) + { + if(p_state) + { + m_vrIk.solver.locomotion.stepThreshold = m_stepDistance.x * GetRelativeScale(); + m_vrIk.solver.locomotion.footDistance = m_stepDistance.y * GetRelativeScale(); + m_vrIk.solver.locomotion.stepHeight.keys = Utils.GetSineKeyframes(Mathf.Clamp01(PlayerSetup.Instance.GetAvatarHeight()) * 0.03f); + m_vrIk.solver.locomotion.heelHeight.keys = Utils.GetSineKeyframes(Mathf.Clamp01(PlayerSetup.Instance.GetAvatarHeight()) * 0.03f); + } + else + { + IKSystem.Instance.ApplyAvatarScaleToIk(PlayerSetup.Instance.GetAvatarHeight()); + m_vrIk.solver.locomotion.stepHeight.keys = Utils.GetSineKeyframes(0.03f); + m_vrIk.solver.locomotion.heelHeight.keys = Utils.GetSineKeyframes(0.03f); + } + } + } + // Arbitrary float GetRelativeScale() { return ((m_avatarScale > 0f) ? (PlayerSetup.Instance._avatar.transform.localScale.y / m_avatarScale) : 0f); } + // Parameters access public float GetUpright() => m_upright; public bool GetGroundedRaw() => m_groundedRaw; public bool GetMoving() => m_moving; diff --git a/ml_amt/Settings.cs b/ml_amt/Settings.cs index 8a2cb9b..930a83d 100644 --- a/ml_amt/Settings.cs +++ b/ml_amt/Settings.cs @@ -20,23 +20,25 @@ namespace ml_amt DetectEmotes, FollowHips, CollisionScale, + ScaledSteps, MassCenter, OverrideFix }; - static bool ms_ikOverrideCrouch = true; - static float ms_crouchLimit = 0.65f; - static bool ms_ikOverrideProne = true; - static float ms_proneLimit = 0.3f; - static bool ms_poseTransitions = true; - static bool ms_adjustedMovement = true; - static bool ms_ikOverrideFly = true; - static bool ms_ikOverrideJump = true; - static bool ms_detectEmotes = true; - static bool ms_followHips = true; - static bool ms_collisionScale = true; - static bool ms_massCenter = true; - static bool ms_overrideFix = true; + public static bool IKOverrideCrouch { get; private set; } = true; + public static float CrouchLimit { get; private set; } = 0.65f; + public static bool IKOverrideProne { get; private set; } = true; + public static float ProneLimit { get; private set; } = 0.3f; + public static bool PoseTransitions { get; private set; } = true; + public static bool AdjustedMovement { get; private set; } = true; + public static bool IKOverrideFly { get; private set; } = true; + public static bool IKOverrideJump { get; private set; } = true; + public static bool DetectEmotes { get; private set; } = true; + public static bool FollowHips { get; private set; } = true; + public static bool MassCenter { get; private set; } = true; + public static bool ScaledSteps { get; private set; } = true; + public static bool CollisionScale { get; private set; } = true; + public static bool OverrideFix { get; private set; } = true; static MelonLoader.MelonPreferences_Category ms_category = null; static List ms_entries = null; @@ -51,8 +53,9 @@ namespace ml_amt static public event Action IKOverrideJumpChange; static public event Action DetectEmotesChange; static public event Action FollowHipsChange; - static public event Action CollisionScaleChange; static public event Action MassCenterChange; + static public event Action ScaledStepsChange; + static public event Action CollisionScaleChange; static public event Action OverrideFixChange; internal static void Init() @@ -61,19 +64,20 @@ namespace ml_amt ms_entries = new List() { - ms_category.CreateEntry(ModSetting.IKOverrideCrouch.ToString(), true), - ms_category.CreateEntry(ModSetting.CrouchLimit.ToString(), 65), - ms_category.CreateEntry(ModSetting.IKOverrideProne.ToString(), true), - ms_category.CreateEntry(ModSetting.ProneLimit.ToString(), 30), - ms_category.CreateEntry(ModSetting.PoseTransitions.ToString(), true), - ms_category.CreateEntry(ModSetting.AdjustedMovement.ToString(), true), - ms_category.CreateEntry(ModSetting.IKOverrideFly.ToString(), true), - ms_category.CreateEntry(ModSetting.IKOverrideJump.ToString(), true), - ms_category.CreateEntry(ModSetting.DetectEmotes.ToString(), true), - ms_category.CreateEntry(ModSetting.FollowHips.ToString(), true), - ms_category.CreateEntry(ModSetting.CollisionScale.ToString(), true), - ms_category.CreateEntry(ModSetting.MassCenter.ToString(), true), - ms_category.CreateEntry(ModSetting.OverrideFix.ToString(), true) + ms_category.CreateEntry(ModSetting.IKOverrideCrouch.ToString(), IKOverrideCrouch), + ms_category.CreateEntry(ModSetting.CrouchLimit.ToString(), (int)(CrouchLimit * 100f)), + ms_category.CreateEntry(ModSetting.IKOverrideProne.ToString(), IKOverrideProne), + ms_category.CreateEntry(ModSetting.ProneLimit.ToString(), (int)(ProneLimit * 100f)), + ms_category.CreateEntry(ModSetting.PoseTransitions.ToString(), PoseTransitions), + ms_category.CreateEntry(ModSetting.AdjustedMovement.ToString(), AdjustedMovement), + ms_category.CreateEntry(ModSetting.IKOverrideFly.ToString(), IKOverrideFly), + ms_category.CreateEntry(ModSetting.IKOverrideJump.ToString(), IKOverrideJump), + ms_category.CreateEntry(ModSetting.DetectEmotes.ToString(), DetectEmotes), + ms_category.CreateEntry(ModSetting.FollowHips.ToString(), FollowHips), + ms_category.CreateEntry(ModSetting.MassCenter.ToString(), MassCenter), + ms_category.CreateEntry(ModSetting.ScaledSteps.ToString(), ScaledSteps), + ms_category.CreateEntry(ModSetting.CollisionScale.ToString(), CollisionScale), + ms_category.CreateEntry(ModSetting.OverrideFix.ToString(), OverrideFix) }; Load(); @@ -105,19 +109,20 @@ namespace ml_amt static void Load() { - ms_ikOverrideCrouch = (bool)ms_entries[(int)ModSetting.IKOverrideCrouch].BoxedValue; - ms_crouchLimit = ((int)ms_entries[(int)ModSetting.CrouchLimit].BoxedValue) * 0.01f; - ms_ikOverrideProne = (bool)ms_entries[(int)ModSetting.IKOverrideProne].BoxedValue; - ms_proneLimit = ((int)ms_entries[(int)ModSetting.ProneLimit].BoxedValue) * 0.01f; - ms_poseTransitions = (bool)ms_entries[(int)ModSetting.PoseTransitions].BoxedValue; - ms_adjustedMovement = (bool)ms_entries[(int)ModSetting.AdjustedMovement].BoxedValue; - ms_ikOverrideFly = (bool)ms_entries[(int)ModSetting.IKOverrideFly].BoxedValue; - ms_ikOverrideJump = (bool)ms_entries[(int)ModSetting.IKOverrideJump].BoxedValue; - ms_detectEmotes = (bool)ms_entries[(int)ModSetting.DetectEmotes].BoxedValue; - ms_followHips = (bool)ms_entries[(int)ModSetting.FollowHips].BoxedValue; - ms_collisionScale = (bool)ms_entries[(int)ModSetting.CollisionScale].BoxedValue; - ms_massCenter = (bool)ms_entries[(int)ModSetting.MassCenter].BoxedValue; - ms_overrideFix = (bool)ms_entries[(int)ModSetting.OverrideFix].BoxedValue; + IKOverrideCrouch = (bool)ms_entries[(int)ModSetting.IKOverrideCrouch].BoxedValue; + CrouchLimit = ((int)ms_entries[(int)ModSetting.CrouchLimit].BoxedValue) * 0.01f; + IKOverrideProne = (bool)ms_entries[(int)ModSetting.IKOverrideProne].BoxedValue; + ProneLimit = ((int)ms_entries[(int)ModSetting.ProneLimit].BoxedValue) * 0.01f; + PoseTransitions = (bool)ms_entries[(int)ModSetting.PoseTransitions].BoxedValue; + AdjustedMovement = (bool)ms_entries[(int)ModSetting.AdjustedMovement].BoxedValue; + IKOverrideFly = (bool)ms_entries[(int)ModSetting.IKOverrideFly].BoxedValue; + IKOverrideJump = (bool)ms_entries[(int)ModSetting.IKOverrideJump].BoxedValue; + DetectEmotes = (bool)ms_entries[(int)ModSetting.DetectEmotes].BoxedValue; + FollowHips = (bool)ms_entries[(int)ModSetting.FollowHips].BoxedValue; + MassCenter = (bool)ms_entries[(int)ModSetting.MassCenter].BoxedValue; + ScaledSteps = (bool)ms_entries[(int)ModSetting.ScaledSteps].BoxedValue; + CollisionScale = (bool)ms_entries[(int)ModSetting.CollisionScale].BoxedValue; + OverrideFix = (bool)ms_entries[(int)ModSetting.OverrideFix].BoxedValue; } static void OnSliderUpdate(string p_name, string p_value) @@ -128,15 +133,15 @@ namespace ml_amt { case ModSetting.CrouchLimit: { - ms_crouchLimit = int.Parse(p_value) * 0.01f; - CrouchLimitChange?.Invoke(ms_crouchLimit); + CrouchLimit = int.Parse(p_value) * 0.01f; + CrouchLimitChange?.Invoke(CrouchLimit); } break; case ModSetting.ProneLimit: { - ms_proneLimit = int.Parse(p_value) * 0.01f; - ProneLimitChange?.Invoke(ms_proneLimit); + ProneLimit = int.Parse(p_value) * 0.01f; + ProneLimitChange?.Invoke(ProneLimit); } break; } @@ -153,78 +158,85 @@ namespace ml_amt { case ModSetting.IKOverrideCrouch: { - ms_ikOverrideCrouch = bool.Parse(p_value); - IKOverrideCrouchChange?.Invoke(ms_ikOverrideCrouch); + IKOverrideCrouch = bool.Parse(p_value); + IKOverrideCrouchChange?.Invoke(IKOverrideCrouch); } break; case ModSetting.IKOverrideProne: { - ms_ikOverrideProne = bool.Parse(p_value); - IKOverrideProneChange?.Invoke(ms_ikOverrideProne); + IKOverrideProne = bool.Parse(p_value); + IKOverrideProneChange?.Invoke(IKOverrideProne); } break; case ModSetting.PoseTransitions: { - ms_poseTransitions = bool.Parse(p_value); - PoseTransitionsChange?.Invoke(ms_poseTransitions); + PoseTransitions = bool.Parse(p_value); + PoseTransitionsChange?.Invoke(PoseTransitions); } break; case ModSetting.AdjustedMovement: { - ms_adjustedMovement = bool.Parse(p_value); - AdjustedMovementChange?.Invoke(ms_adjustedMovement); + AdjustedMovement = bool.Parse(p_value); + AdjustedMovementChange?.Invoke(AdjustedMovement); } break; case ModSetting.IKOverrideFly: { - ms_ikOverrideFly = bool.Parse(p_value); - IKOverrideFlyChange?.Invoke(ms_ikOverrideFly); + IKOverrideFly = bool.Parse(p_value); + IKOverrideFlyChange?.Invoke(IKOverrideFly); } break; case ModSetting.IKOverrideJump: { - ms_ikOverrideJump = bool.Parse(p_value); - IKOverrideJumpChange?.Invoke(ms_ikOverrideJump); + IKOverrideJump = bool.Parse(p_value); + IKOverrideJumpChange?.Invoke(IKOverrideJump); } break; case ModSetting.DetectEmotes: { - ms_detectEmotes = bool.Parse(p_value); - DetectEmotesChange?.Invoke(ms_detectEmotes); + DetectEmotes = bool.Parse(p_value); + DetectEmotesChange?.Invoke(DetectEmotes); } break; case ModSetting.FollowHips: { - ms_followHips = bool.Parse(p_value); - FollowHipsChange?.Invoke(ms_followHips); - } - break; - - case ModSetting.CollisionScale: - { - ms_collisionScale = bool.Parse(p_value); - CollisionScaleChange?.Invoke(ms_collisionScale); + FollowHips = bool.Parse(p_value); + FollowHipsChange?.Invoke(FollowHips); } break; case ModSetting.MassCenter: { - ms_massCenter = bool.Parse(p_value); - MassCenterChange?.Invoke(ms_massCenter); + MassCenter = bool.Parse(p_value); + MassCenterChange?.Invoke(MassCenter); + } + break; + + case ModSetting.ScaledSteps: + { + ScaledSteps = bool.Parse(p_value); + ScaledStepsChange?.Invoke(ScaledSteps); + } + break; + + case ModSetting.CollisionScale: + { + CollisionScale = bool.Parse(p_value); + CollisionScaleChange?.Invoke(CollisionScale); } break; case ModSetting.OverrideFix: { - ms_overrideFix = bool.Parse(p_value); - OverrideFixChange?.Invoke(ms_overrideFix); + OverrideFix = bool.Parse(p_value); + OverrideFixChange?.Invoke(OverrideFix); } break; } @@ -232,58 +244,5 @@ namespace ml_amt ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value); } } - - public static bool IKOverrideCrouch - { - get => ms_ikOverrideCrouch; - } - public static float CrouchLimit - { - get => ms_crouchLimit; - } - public static bool IKOverrideProne - { - get => ms_ikOverrideProne; - } - public static float ProneLimit - { - get => ms_proneLimit; - } - public static bool PoseTransitions - { - get => ms_poseTransitions; - } - public static bool AdjustedMovement - { - get => ms_adjustedMovement; - } - public static bool IKOverrideFly - { - get => ms_ikOverrideFly; - } - public static bool IKOverrideJump - { - get => ms_ikOverrideJump; - } - public static bool DetectEmotes - { - get => ms_detectEmotes; - } - public static bool FollowHips - { - get => ms_followHips; - } - public static bool CollisionScale - { - get => ms_collisionScale; - } - public static bool MassCenter - { - get => ms_massCenter; - } - public static bool OverrideFix - { - get => ms_overrideFix; - } } } diff --git a/ml_amt/Utils.cs b/ml_amt/Utils.cs index 31b75d8..140cadc 100644 --- a/ml_amt/Utils.cs +++ b/ml_amt/Utils.cs @@ -1,10 +1,12 @@ using UnityEngine; -using ABI_RC.Systems.IK; +using System.Reflection; namespace ml_amt { static class Utils { + static MethodInfo ms_getSineKeyframes = typeof(RootMotion.FinalIK.IKSolverVR).GetMethod("GetSineKeyframes", BindingFlags.NonPublic | BindingFlags.Static); + public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded); // Extensions @@ -12,5 +14,10 @@ namespace ml_amt { return Matrix4x4.TRS(p_pos ? p_transform.position : Vector3.zero, p_rot ? p_transform.rotation : Quaternion.identity, p_scl ? p_transform.localScale : Vector3.one); } + + public static Keyframe[] GetSineKeyframes(float p_mag) + { + return (Keyframe[])ms_getSineKeyframes.Invoke(null, new object[] { p_mag }); + } } } diff --git a/ml_amt/resources/menu.js b/ml_amt/resources/menu.js index 9298fff..152a75c 100644 --- a/ml_amt/resources/menu.js +++ b/ml_amt/resources/menu.js @@ -256,6 +256,13 @@ function inp_toggle_mod_amt(_obj, _callbackName) {
+ +
+
Scaled locomotion steps:
+
+
+
+
Alternative avatar collider scale:
diff --git a/ml_dht/HeadTracked.cs b/ml_dht/HeadTracked.cs index a7ac529..00b116d 100644 --- a/ml_dht/HeadTracked.cs +++ b/ml_dht/HeadTracked.cs @@ -34,6 +34,7 @@ namespace ml_dht Quaternion m_bindRotation; Quaternion m_lastHeadRotation; + // Unity events void Start() { Settings.EnabledChange += this.SetEnabled; @@ -56,6 +57,7 @@ namespace ml_dht Settings.FaceOverrideChange -= this.SetFaceOverride; } + // Tracking updates public void UpdateTrackingData(ref TrackingData p_data) { m_headPosition.Set(p_data.m_headPositionX * (m_mirrored ? -1f : 1f), p_data.m_headPositionY, p_data.m_headPositionZ); @@ -77,6 +79,7 @@ namespace ml_dht } } + // Game events internal void OnEyeControllerUpdate(CVREyeController p_component) { if(m_enabled) @@ -139,7 +142,8 @@ namespace ml_dht m_bindRotation = Quaternion.identity; } - public void SetEnabled(bool p_state) + // Settings + internal void SetEnabled(bool p_state) { if(m_enabled != p_state) { @@ -148,7 +152,7 @@ namespace ml_dht m_lastHeadRotation = ((m_headBone != null) ? m_headBone.rotation : m_bindRotation); } } - public void SetHeadTracking(bool p_state) + internal void SetHeadTracking(bool p_state) { if(m_headTracking != p_state) { @@ -157,23 +161,23 @@ namespace ml_dht m_lastHeadRotation = ((m_headBone != null) ? m_headBone.rotation : m_bindRotation); } } - public void SetEyeTracking(bool p_state) + internal void SetEyeTracking(bool p_state) { m_eyeTracking = p_state; } - public void SetBlinking(bool p_state) + internal void SetBlinking(bool p_state) { m_blinking = p_state; } - public void SetSmoothing(float p_value) + internal void SetSmoothing(float p_value) { m_smoothing = 1f - Mathf.Clamp(p_value, 0f, 0.99f); } - public void SetMirrored(bool p_state) + internal void SetMirrored(bool p_state) { m_mirrored = p_state; } - public void SetFaceOverride(bool p_state) + internal void SetFaceOverride(bool p_state) { m_faceOverride = p_state; } diff --git a/ml_dht/Settings.cs b/ml_dht/Settings.cs index 12057f2..7251fed 100644 --- a/ml_dht/Settings.cs +++ b/ml_dht/Settings.cs @@ -18,13 +18,13 @@ namespace ml_dht FaceOverride } - static bool ms_enabled = false; - static bool ms_headTracking = true; - static bool ms_eyeTracking = true; - static bool ms_blinking = true; - static bool ms_mirrored = false; - static float ms_smoothing = 0.5f; - static bool ms_faceOverride = true; + public static bool Enabled { get; private set; } = false; + public static bool HeadTracking { get; private set; } = true; + public static bool EyeTracking { get; private set; } = true; + public static bool Blinking { get; private set; } = true; + public static bool Mirrored { get; private set; } = false; + public static float Smoothing { get; private set; } = 0.5f; + public static bool FaceOverride { get; private set; } = true; static MelonLoader.MelonPreferences_Category ms_category = null; static List ms_entries = null; @@ -43,13 +43,13 @@ namespace ml_dht ms_entries = new List() { - ms_category.CreateEntry(ModSetting.Enabled.ToString(), false), - ms_category.CreateEntry(ModSetting.HeadTracking.ToString(), false), - ms_category.CreateEntry(ModSetting.EyeTracking.ToString(), true), - ms_category.CreateEntry(ModSetting.Blinking.ToString(), true), - ms_category.CreateEntry(ModSetting.Mirrored.ToString(), false), - ms_category.CreateEntry(ModSetting.Smoothing.ToString(), 50), - ms_category.CreateEntry(ModSetting.FaceOverride.ToString(), true) + ms_category.CreateEntry(ModSetting.Enabled.ToString(), Enabled), + ms_category.CreateEntry(ModSetting.HeadTracking.ToString(), HeadTracking), + ms_category.CreateEntry(ModSetting.EyeTracking.ToString(), EyeTracking), + ms_category.CreateEntry(ModSetting.Blinking.ToString(), Blinking), + ms_category.CreateEntry(ModSetting.Mirrored.ToString(), Mirrored), + ms_category.CreateEntry(ModSetting.Smoothing.ToString(), (int)(Smoothing * 50f)), + ms_category.CreateEntry(ModSetting.FaceOverride.ToString(), FaceOverride) }; Load(); @@ -81,13 +81,13 @@ namespace ml_dht static void Load() { - ms_enabled = (bool)ms_entries[(int)ModSetting.Enabled].BoxedValue; - ms_headTracking = (bool)ms_entries[(int)ModSetting.HeadTracking].BoxedValue; - ms_eyeTracking = (bool)ms_entries[(int)ModSetting.EyeTracking].BoxedValue; - ms_blinking = (bool)ms_entries[(int)ModSetting.Blinking].BoxedValue; - ms_mirrored = (bool)ms_entries[(int)ModSetting.Mirrored].BoxedValue; - ms_smoothing = ((int)ms_entries[(int)ModSetting.Smoothing].BoxedValue) * 0.01f; - ms_faceOverride = (bool)ms_entries[(int)ModSetting.FaceOverride].BoxedValue; + Enabled = (bool)ms_entries[(int)ModSetting.Enabled].BoxedValue; + HeadTracking = (bool)ms_entries[(int)ModSetting.HeadTracking].BoxedValue; + EyeTracking = (bool)ms_entries[(int)ModSetting.EyeTracking].BoxedValue; + Blinking = (bool)ms_entries[(int)ModSetting.Blinking].BoxedValue; + Mirrored = (bool)ms_entries[(int)ModSetting.Mirrored].BoxedValue; + Smoothing = ((int)ms_entries[(int)ModSetting.Smoothing].BoxedValue) * 0.01f; + FaceOverride = (bool)ms_entries[(int)ModSetting.FaceOverride].BoxedValue; } static void OnSliderUpdate(string p_name, string p_value) @@ -98,8 +98,8 @@ namespace ml_dht { case ModSetting.Smoothing: { - ms_smoothing = int.Parse(p_value) * 0.01f; - SmoothingChange?.Invoke(ms_smoothing); + Smoothing = int.Parse(p_value) * 0.01f; + SmoothingChange?.Invoke(Smoothing); } break; } @@ -116,43 +116,43 @@ namespace ml_dht { case ModSetting.Enabled: { - ms_enabled = bool.Parse(p_value); - EnabledChange?.Invoke(ms_enabled); + Enabled = bool.Parse(p_value); + EnabledChange?.Invoke(Enabled); } break; case ModSetting.HeadTracking: { - ms_headTracking = bool.Parse(p_value); - HeadTrackingChange?.Invoke(ms_headTracking); + HeadTracking = bool.Parse(p_value); + HeadTrackingChange?.Invoke(HeadTracking); } break; case ModSetting.EyeTracking: { - ms_eyeTracking = bool.Parse(p_value); - EyeTrackingChange?.Invoke(ms_eyeTracking); + EyeTracking = bool.Parse(p_value); + EyeTrackingChange?.Invoke(EyeTracking); } break; case ModSetting.Blinking: { - ms_blinking = bool.Parse(p_value); - BlinkingChange?.Invoke(ms_blinking); + Blinking = bool.Parse(p_value); + BlinkingChange?.Invoke(Blinking); } break; case ModSetting.Mirrored: { - ms_mirrored = bool.Parse(p_value); - MirroredChange?.Invoke(ms_mirrored); + Mirrored = bool.Parse(p_value); + MirroredChange?.Invoke(Mirrored); } break; case ModSetting.FaceOverride: { - ms_faceOverride = bool.Parse(p_value); - FaceOverrideChange?.Invoke(ms_faceOverride); + FaceOverride = bool.Parse(p_value); + FaceOverrideChange?.Invoke(FaceOverride); } break; } @@ -160,34 +160,5 @@ namespace ml_dht ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value); } } - - public static bool Enabled - { - get => ms_enabled; - } - public static bool HeadTracking - { - get => ms_headTracking; - } - public static bool EyeTracking - { - get => ms_eyeTracking; - } - public static bool Blinking - { - get => ms_blinking; - } - public static bool Mirrored - { - get => ms_mirrored; - } - public static float Smoothing - { - get => ms_smoothing; - } - public static bool FaceOverride - { - get => ms_faceOverride; - } } } diff --git a/ml_lme/LeapTracked.cs b/ml_lme/LeapTracked.cs index 4725404..3c66318 100644 --- a/ml_lme/LeapTracked.cs +++ b/ml_lme/LeapTracked.cs @@ -37,6 +37,7 @@ namespace ml_lme bool m_leftTargetActive = false; bool m_rightTargetActive = false; + // Unity events void Start() { m_inVR = Utils.IsInVR(); @@ -51,51 +52,20 @@ namespace ml_lme m_rightHandTarget.localPosition = Vector3.zero; m_rightHandTarget.localRotation = Quaternion.identity; - Settings.EnabledChange += this.SetEnabled; - Settings.FingersOnlyChange += this.SetFingersOnly; - Settings.TrackElbowsChange += this.SetTrackElbows; + Settings.EnabledChange += this.OnEnabledChange; + Settings.FingersOnlyChange += this.OnFingersOnlyChange; + Settings.TrackElbowsChange += this.OnTrackElbowsChange; - SetEnabled(Settings.Enabled); - SetFingersOnly(Settings.FingersOnly); - SetTrackElbows(Settings.TrackElbows); + OnEnabledChange(Settings.Enabled); + OnFingersOnlyChange(Settings.FingersOnly); + OnTrackElbowsChange(Settings.TrackElbows); } void OnDestroy() { - Settings.EnabledChange -= this.SetEnabled; - Settings.FingersOnlyChange -= this.SetFingersOnly; - Settings.TrackElbowsChange -= this.SetTrackElbows; - } - - void SetEnabled(bool p_state) - { - m_enabled = p_state; - - RefreshArmIK(); - if(!m_enabled || m_fingersOnly) - RestoreVRIK(); - } - - void SetFingersOnly(bool p_state) - { - m_fingersOnly = p_state; - - RefreshArmIK(); - if(!m_enabled || m_fingersOnly) - RestoreVRIK(); - } - - void SetTrackElbows(bool p_state) - { - m_trackElbows = p_state; - - if((m_leftArmIK != null) && (m_rightArmIK != null)) - { - m_leftArmIK.solver.arm.bendGoalWeight = (m_trackElbows ? 1f : 0f); - m_rightArmIK.solver.arm.bendGoalWeight = (m_trackElbows ? 1f : 0f); - } - - RestoreVRIK(); + Settings.EnabledChange -= this.OnEnabledChange; + Settings.FingersOnlyChange -= this.OnFingersOnlyChange; + Settings.TrackElbowsChange -= this.OnTrackElbowsChange; } void Update() @@ -168,6 +138,7 @@ namespace ml_lme } } + // Tracking update void UpdateFingers(GestureMatcher.LeapData p_data) { if(p_data.m_leftHand.m_present) @@ -227,6 +198,7 @@ namespace ml_lme } } + // Game events internal void OnAvatarClear() { m_vrIK = null; @@ -348,6 +320,7 @@ namespace ml_lme } } + // IK updates void OnIKPreUpdate() { m_armsWeights.Set( @@ -376,6 +349,39 @@ namespace ml_lme m_vrIK.solver.rightArm.rotationWeight = m_armsWeights.w; } + // Settings + void OnEnabledChange(bool p_state) + { + m_enabled = p_state; + + RefreshArmIK(); + if(!m_enabled || m_fingersOnly) + RestoreVRIK(); + } + + void OnFingersOnlyChange(bool p_state) + { + m_fingersOnly = p_state; + + RefreshArmIK(); + if(!m_enabled || m_fingersOnly) + RestoreVRIK(); + } + + void OnTrackElbowsChange(bool p_state) + { + m_trackElbows = p_state; + + if((m_leftArmIK != null) && (m_rightArmIK != null)) + { + m_leftArmIK.solver.arm.bendGoalWeight = (m_trackElbows ? 1f : 0f); + m_rightArmIK.solver.arm.bendGoalWeight = (m_trackElbows ? 1f : 0f); + } + + RestoreVRIK(); + } + + // Arbitrary void RestoreVRIK() { if(m_vrIK != null) diff --git a/ml_lme/Settings.cs b/ml_lme/Settings.cs index 0015b43..2ebbaa6 100644 --- a/ml_lme/Settings.cs +++ b/ml_lme/Settings.cs @@ -37,18 +37,18 @@ namespace ml_lme GripThreadhold }; - static bool ms_enabled = false; - static Vector3 ms_desktopOffset = new Vector3(0f, -0.45f, 0.3f); - static bool ms_fingersOnly = false; - static bool ms_modelVisibility = false; - static LeapTrackingMode ms_trackingMode = LeapTrackingMode.Desktop; - static Vector3 ms_rootAngle = Vector3.zero; - static bool ms_headAttach = false; - static Vector3 ms_headOffset = new Vector3(0f, -0.3f, 0.15f); - static bool ms_trackElbows = true; - static bool ms_input = true; - static float ms_interactThreadhold = 0.8f; - static float ms_gripThreadhold = 0.4f; + public static bool Enabled { get; private set; } = false; + public static Vector3 DesktopOffset { get; private set; } = new Vector3(0f, -0.45f, 0.3f); + public static bool FingersOnly { get; private set; } = false; + public static bool ModelVisibility { get; private set; } = false; + public static LeapTrackingMode TrackingMode { get; private set; } = LeapTrackingMode.Desktop; + public static Vector3 RootAngle { get; private set; } = Vector3.zero; + public static bool HeadAttach { get; private set; } = false; + public static Vector3 HeadOffset { get; private set; } = new Vector3(0f, -0.3f, 0.15f); + public static bool TrackElbows { get; private set; } = true; + public static bool Input { get; private set; } = true; + public static float InteractThreadhold { get; private set; } = 0.8f; + public static float GripThreadhold { get; private set; } = 0.4f; static MelonLoader.MelonPreferences_Category ms_category = null; static List ms_entries = null; @@ -72,24 +72,24 @@ namespace ml_lme ms_entries = new List() { - ms_category.CreateEntry(ModSetting.Enabled.ToString(), ms_enabled), - ms_category.CreateEntry(ModSetting.DesktopX.ToString(), 0), - ms_category.CreateEntry(ModSetting.DesktopY.ToString(), -45), - ms_category.CreateEntry(ModSetting.DesktopZ.ToString(), 30), - ms_category.CreateEntry(ModSetting.FingersOnly.ToString(), ms_modelVisibility), - ms_category.CreateEntry(ModSetting.Model.ToString(), ms_modelVisibility), - ms_category.CreateEntry(ModSetting.Mode.ToString(), (int)ms_trackingMode), - ms_category.CreateEntry(ModSetting.AngleX.ToString(), 0), - ms_category.CreateEntry(ModSetting.AngleY.ToString(), 0), - ms_category.CreateEntry(ModSetting.AngleZ.ToString(), 0), - ms_category.CreateEntry(ModSetting.Head.ToString(), ms_headAttach), - ms_category.CreateEntry(ModSetting.HeadX.ToString(), 0), - ms_category.CreateEntry(ModSetting.HeadY.ToString(), -30), - ms_category.CreateEntry(ModSetting.HeadZ.ToString(), 15), - ms_category.CreateEntry(ModSetting.TrackElbows.ToString(), true), - ms_category.CreateEntry(ModSetting.Input.ToString(), true), - ms_category.CreateEntry(ModSetting.InteractThreadhold.ToString(), 80), - ms_category.CreateEntry(ModSetting.GripThreadhold.ToString(), 40), + ms_category.CreateEntry(ModSetting.Enabled.ToString(), Enabled), + ms_category.CreateEntry(ModSetting.DesktopX.ToString(), (int)(DesktopOffset.x * 100f)), + ms_category.CreateEntry(ModSetting.DesktopY.ToString(), (int)(DesktopOffset.y * 100f)), + ms_category.CreateEntry(ModSetting.DesktopZ.ToString(), (int)(DesktopOffset.z * 100f)), + ms_category.CreateEntry(ModSetting.FingersOnly.ToString(), FingersOnly), + ms_category.CreateEntry(ModSetting.Model.ToString(), ModelVisibility), + ms_category.CreateEntry(ModSetting.Mode.ToString(), (int)TrackingMode), + ms_category.CreateEntry(ModSetting.AngleX.ToString(), (int)(RootAngle.x * 100f)), + ms_category.CreateEntry(ModSetting.AngleY.ToString(), (int)(RootAngle.y * 100f)), + ms_category.CreateEntry(ModSetting.AngleZ.ToString(), (int)(RootAngle.z * 100f)), + ms_category.CreateEntry(ModSetting.Head.ToString(), HeadAttach), + ms_category.CreateEntry(ModSetting.HeadX.ToString(), (int)(HeadOffset.x * 100f)), + ms_category.CreateEntry(ModSetting.HeadY.ToString(), (int)(HeadOffset.y * 100f)), + ms_category.CreateEntry(ModSetting.HeadZ.ToString(), (int)(HeadOffset.z * 100f)), + ms_category.CreateEntry(ModSetting.TrackElbows.ToString(), TrackElbows), + ms_category.CreateEntry(ModSetting.Input.ToString(), Input), + ms_category.CreateEntry(ModSetting.InteractThreadhold.ToString(), (int)(InteractThreadhold * 100f)), + ms_category.CreateEntry(ModSetting.GripThreadhold.ToString(), (int)(GripThreadhold * 100f)), }; Load(); @@ -122,30 +122,30 @@ namespace ml_lme static void Load() { - ms_enabled = (bool)ms_entries[(int)ModSetting.Enabled].BoxedValue; - ms_desktopOffset = new Vector3( + Enabled = (bool)ms_entries[(int)ModSetting.Enabled].BoxedValue; + DesktopOffset = new Vector3( (int)ms_entries[(int)ModSetting.DesktopX].BoxedValue, (int)ms_entries[(int)ModSetting.DesktopY].BoxedValue, (int)ms_entries[(int)ModSetting.DesktopZ].BoxedValue ) * 0.01f; - ms_fingersOnly = (bool)ms_entries[(int)ModSetting.FingersOnly].BoxedValue; - ms_modelVisibility = (bool)ms_entries[(int)ModSetting.Model].BoxedValue; - ms_trackingMode = (LeapTrackingMode)(int)ms_entries[(int)ModSetting.Mode].BoxedValue; - ms_rootAngle = new Vector3( + FingersOnly = (bool)ms_entries[(int)ModSetting.FingersOnly].BoxedValue; + ModelVisibility = (bool)ms_entries[(int)ModSetting.Model].BoxedValue; + TrackingMode = (LeapTrackingMode)(int)ms_entries[(int)ModSetting.Mode].BoxedValue; + RootAngle = new Vector3( (int)ms_entries[(int)ModSetting.AngleX].BoxedValue, (int)ms_entries[(int)ModSetting.AngleY].BoxedValue, (int)ms_entries[(int)ModSetting.AngleZ].BoxedValue ); - ms_headAttach = (bool)ms_entries[(int)ModSetting.Head].BoxedValue; - ms_headOffset = new Vector3( + HeadAttach = (bool)ms_entries[(int)ModSetting.Head].BoxedValue; + HeadOffset = new Vector3( (int)ms_entries[(int)ModSetting.HeadX].BoxedValue, (int)ms_entries[(int)ModSetting.HeadY].BoxedValue, (int)ms_entries[(int)ModSetting.HeadZ].BoxedValue ) * 0.01f; - ms_trackElbows = (bool)ms_entries[(int)ModSetting.TrackElbows].BoxedValue; - ms_input = (bool)ms_entries[(int)ModSetting.Input].BoxedValue; - ms_interactThreadhold = (int)ms_entries[(int)ModSetting.InteractThreadhold].BoxedValue * 0.01f; - ms_gripThreadhold = (int)ms_entries[(int)ModSetting.GripThreadhold].BoxedValue * 0.01f; + TrackElbows = (bool)ms_entries[(int)ModSetting.TrackElbows].BoxedValue; + Input = (bool)ms_entries[(int)ModSetting.Input].BoxedValue; + InteractThreadhold = (int)ms_entries[(int)ModSetting.InteractThreadhold].BoxedValue * 0.01f; + GripThreadhold = (int)ms_entries[(int)ModSetting.GripThreadhold].BoxedValue * 0.01f; } static void OnToggleUpdate(string p_name, string p_value) @@ -156,43 +156,43 @@ namespace ml_lme { case ModSetting.Enabled: { - ms_enabled = bool.Parse(p_value); - EnabledChange?.Invoke(ms_enabled); + Enabled = bool.Parse(p_value); + EnabledChange?.Invoke(Enabled); } break; case ModSetting.FingersOnly: { - ms_fingersOnly = bool.Parse(p_value); - FingersOnlyChange?.Invoke(ms_fingersOnly); + FingersOnly = bool.Parse(p_value); + FingersOnlyChange?.Invoke(FingersOnly); } break; case ModSetting.Model: { - ms_modelVisibility = bool.Parse(p_value); - ModelVisibilityChange?.Invoke(ms_modelVisibility); + ModelVisibility = bool.Parse(p_value); + ModelVisibilityChange?.Invoke(ModelVisibility); } break; case ModSetting.Head: { - ms_headAttach = bool.Parse(p_value); - HeadAttachChange?.Invoke(ms_headAttach); + HeadAttach = bool.Parse(p_value); + HeadAttachChange?.Invoke(HeadAttach); } break; case ModSetting.TrackElbows: { - ms_trackElbows = bool.Parse(p_value); - TrackElbowsChange?.Invoke(ms_trackElbows); + TrackElbows = bool.Parse(p_value); + TrackElbowsChange?.Invoke(TrackElbows); } break; case ModSetting.Input: { - ms_input = bool.Parse(p_value); - InputChange?.Invoke(ms_input); + Input = bool.Parse(p_value); + InputChange?.Invoke(Input); } break; } @@ -209,72 +209,72 @@ namespace ml_lme { case ModSetting.DesktopX: { - ms_desktopOffset.x = int.Parse(p_value) * 0.01f; - DesktopOffsetChange?.Invoke(ms_desktopOffset); + DesktopOffset.Set(int.Parse(p_value) * 0.01f, DesktopOffset.y, DesktopOffset.z); + DesktopOffsetChange?.Invoke(DesktopOffset); } break; case ModSetting.DesktopY: { - ms_desktopOffset.y = int.Parse(p_value) * 0.01f; - DesktopOffsetChange?.Invoke(ms_desktopOffset); + DesktopOffset.Set(DesktopOffset.x, int.Parse(p_value) * 0.01f, DesktopOffset.z); + DesktopOffsetChange?.Invoke(DesktopOffset); } break; case ModSetting.DesktopZ: { - ms_desktopOffset.z = int.Parse(p_value) * 0.01f; - DesktopOffsetChange?.Invoke(ms_desktopOffset); + DesktopOffset.Set(DesktopOffset.x, DesktopOffset.y, int.Parse(p_value) * 0.01f); + DesktopOffsetChange?.Invoke(DesktopOffset); } break; case ModSetting.AngleX: { - ms_rootAngle.x = int.Parse(p_value); - RootAngleChange?.Invoke(ms_rootAngle); + RootAngle.Set(int.Parse(p_value), RootAngle.y, RootAngle.z); + RootAngleChange?.Invoke(RootAngle); } break; case ModSetting.AngleY: { - ms_rootAngle.y = int.Parse(p_value); - RootAngleChange?.Invoke(ms_rootAngle); + RootAngle.Set(RootAngle.x, int.Parse(p_value), RootAngle.z); + RootAngleChange?.Invoke(RootAngle); } break; case ModSetting.AngleZ: { - ms_rootAngle.z = int.Parse(p_value); - RootAngleChange?.Invoke(ms_rootAngle); + RootAngle.Set(RootAngle.x, RootAngle.y, int.Parse(p_value)); + RootAngleChange?.Invoke(RootAngle); } break; case ModSetting.HeadX: { - ms_headOffset.x = int.Parse(p_value) * 0.01f; - HeadOffsetChange?.Invoke(ms_headOffset); + HeadOffset.Set(int.Parse(p_value) * 0.01f, HeadOffset.y, HeadOffset.z); + HeadOffsetChange?.Invoke(HeadOffset); } break; case ModSetting.HeadY: { - ms_headOffset.y = int.Parse(p_value) * 0.01f; - HeadOffsetChange?.Invoke(ms_headOffset); + HeadOffset.Set(HeadOffset.x, int.Parse(p_value) * 0.01f, HeadOffset.z); + HeadOffsetChange?.Invoke(HeadOffset); } break; case ModSetting.HeadZ: { - ms_headOffset.z = int.Parse(p_value) * 0.01f; - HeadOffsetChange?.Invoke(ms_headOffset); + HeadOffset.Set(HeadOffset.x, HeadOffset.y, int.Parse(p_value) * 0.01f); + HeadOffsetChange?.Invoke(HeadOffset); } break; case ModSetting.InteractThreadhold: { - ms_interactThreadhold = int.Parse(p_value) * 0.01f; - InteractThreadholdChange?.Invoke(ms_interactThreadhold); + InteractThreadhold = int.Parse(p_value) * 0.01f; + InteractThreadholdChange?.Invoke(InteractThreadhold); } break; case ModSetting.GripThreadhold: { - ms_gripThreadhold = int.Parse(p_value) * 0.01f; - GripThreadholdChange?.Invoke(ms_gripThreadhold); + GripThreadhold = int.Parse(p_value) * 0.01f; + GripThreadholdChange?.Invoke(GripThreadhold); } break; } @@ -291,8 +291,8 @@ namespace ml_lme { case ModSetting.Mode: { - ms_trackingMode = (LeapTrackingMode)int.Parse(p_value); - TrackingModeChange?.Invoke(ms_trackingMode); + TrackingMode = (LeapTrackingMode)int.Parse(p_value); + TrackingModeChange?.Invoke(TrackingMode); } break; } @@ -300,54 +300,5 @@ namespace ml_lme ms_entries[(int)l_setting].BoxedValue = int.Parse(p_value); } } - - public static bool Enabled - { - get => ms_enabled; - } - public static Vector3 DesktopOffset - { - get => ms_desktopOffset; - } - public static bool FingersOnly - { - get => ms_fingersOnly; - } - public static bool ModelVisibility - { - get => ms_modelVisibility; - } - public static LeapTrackingMode TrackingMode - { - get => ms_trackingMode; - } - public static Vector3 RootAngle - { - get => ms_rootAngle; - } - public static bool HeadAttach - { - get => ms_headAttach; - } - public static Vector3 HeadOffset - { - get => ms_headOffset; - } - public static bool TrackElbows - { - get => ms_trackElbows; - } - public static bool Input - { - get => ms_input; - } - public static float InteractThreadhold - { - get => ms_interactThreadhold; - } - public static float GripThreadhold - { - get => ms_gripThreadhold; - } } } diff --git a/ml_pam/ArmMover.cs b/ml_pam/ArmMover.cs index 01db46d..d9c5f7f 100644 --- a/ml_pam/ArmMover.cs +++ b/ml_pam/ArmMover.cs @@ -32,6 +32,7 @@ namespace ml_pam Matrix4x4 m_offset = Matrix4x4.identity; bool m_targetActive = false; + // Unity events void Start() { m_inVR = Utils.IsInVR(); @@ -67,6 +68,7 @@ namespace ml_pam } } + // IK updates void OnIKPreUpdate() { m_armWeight.Set(m_vrIK.solver.rightArm.positionWeight, m_vrIK.solver.rightArm.rotationWeight); diff --git a/ml_pam/Settings.cs b/ml_pam/Settings.cs index c3fc659..488f2df 100644 --- a/ml_pam/Settings.cs +++ b/ml_pam/Settings.cs @@ -13,8 +13,8 @@ namespace ml_pam GrabOffset } - static bool ms_enabled = true; - static float ms_grabOffset = 0.25f; + public static bool Enabled { get; private set; } = true; + public static float GrabOffset { get; private set; } = 0.25f; static MelonLoader.MelonPreferences_Category ms_category = null; static List ms_entries = null; @@ -28,8 +28,8 @@ namespace ml_pam ms_entries = new List() { - ms_category.CreateEntry(ModSetting.Enabled.ToString(), ms_enabled), - ms_category.CreateEntry(ModSetting.GrabOffset.ToString(), 25), + ms_category.CreateEntry(ModSetting.Enabled.ToString(), Enabled), + ms_category.CreateEntry(ModSetting.GrabOffset.ToString(), (int)(GrabOffset * 100f)), }; Load(); @@ -61,8 +61,8 @@ namespace ml_pam static void Load() { - ms_enabled = (bool)ms_entries[(int)ModSetting.Enabled].BoxedValue; - ms_grabOffset = (int)ms_entries[(int)ModSetting.GrabOffset].BoxedValue * 0.01f; + Enabled = (bool)ms_entries[(int)ModSetting.Enabled].BoxedValue; + GrabOffset = (int)ms_entries[(int)ModSetting.GrabOffset].BoxedValue * 0.01f; } static void OnToggleUpdate(string p_name, string p_value) @@ -73,8 +73,8 @@ namespace ml_pam { case ModSetting.Enabled: { - ms_enabled = bool.Parse(p_value); - EnabledChange?.Invoke(ms_enabled); + Enabled = bool.Parse(p_value); + EnabledChange?.Invoke(Enabled); } break; } @@ -91,8 +91,8 @@ namespace ml_pam { case ModSetting.GrabOffset: { - ms_grabOffset = int.Parse(p_value) * 0.01f; - GrabOffsetChange?.Invoke(ms_grabOffset); + GrabOffset = int.Parse(p_value) * 0.01f; + GrabOffsetChange?.Invoke(GrabOffset); } break; } @@ -100,14 +100,5 @@ namespace ml_pam ms_entries[(int)l_setting].BoxedValue = int.Parse(p_value); } } - - public static bool Enabled - { - get => ms_enabled; - } - public static float GrabOffset - { - get => ms_grabOffset; - } } } From 1dad5d6415e54eebe46cc5054d8ab2d4221a90f1 Mon Sep 17 00:00:00 2001 From: SDraw Date: Fri, 3 Mar 2023 23:30:14 +0300 Subject: [PATCH 07/11] Animator state check --- ml_amt/Main.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ml_amt/Main.cs b/ml_amt/Main.cs index 3999cb9..05ecf6b 100644 --- a/ml_amt/Main.cs +++ b/ml_amt/Main.cs @@ -256,13 +256,15 @@ namespace ml_amt return false; } - static void OnOverride_Prefix(ref CVRAnimatorManager __instance) + static void OnOverride_Prefix(ref CVRAnimatorManager __instance, ref bool __state) { try { if(Settings.OverrideFix && (__instance.animator != null)) { - __instance.animator.enabled = false; + __state = __instance.animator.enabled; + if(__state) + __instance.animator.enabled = false; __instance.animator.WriteDefaultValues(); } } @@ -271,14 +273,15 @@ namespace ml_amt MelonLoader.MelonLogger.Error(l_exception); } } - static void OnOverride_Postfix(ref CVRAnimatorManager __instance) + static void OnOverride_Postfix(ref CVRAnimatorManager __instance, bool __state) { try { if(Settings.OverrideFix && (__instance.animator != null)) { - __instance.animator.enabled = true; - __instance.animator.Update(0f); + __instance.animator.enabled = __state; + if(__state) + __instance.animator.Update(0f); } } catch(System.Exception l_exception) From dedcc5835df12ca3137cd6ac745b3914df479a98 Mon Sep 17 00:00:00 2001 From: SDraw Date: Tue, 7 Mar 2023 20:01:15 +0000 Subject: [PATCH 08/11] Info edit --- README.md | 14 -------------- ml_egn/README.md | 1 + 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 9e1ab38..0000000 --- a/README.md +++ /dev/null @@ -1,14 +0,0 @@ -Merged set of MelonLoader mods for ChilloutVR. - -**State table for game build 2022r170:** -| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | Current Status | Notes | -|-----------|------------|----------------|-----------------------------------------------------------------|----------------|-------| -| Avatar Change Info | ml_aci | 1.0.3 | Retired | Retired | Superseded by `Extended Game Notifications` -| Avatar Motion Tweaker | ml_amt | 1.2.3 | Yes, update review | Working | -| Desktop Head Tracking | ml_dht | 1.1.1 | Yes | Working | -| Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working | -| Extended Game Notifications | ml_egn | 1.0.1 | Yes | Working -| Four Point Tracking | ml_fpt | 1.0.9 | Retired | Deprecated | In-game feature since 2022r170 update -| Leap Motion Extension | ml_lme | 1.3.1 | Yes, update review | Working | -| Pickup Arm Movement | ml_pam | 1.0.1 | Retired, update review | Working | -| Server Connection Info | ml_sci | 1.0.2 | Retired | Retired | Superseded by `Extended Game Notifications` diff --git a/ml_egn/README.md b/ml_egn/README.md index 15d5fe7..5976ccc 100644 --- a/ml_egn/README.md +++ b/ml_egn/README.md @@ -4,6 +4,7 @@ This mod shows main menu notifications and HUD popups upon: * Prop spawning/deletion * Server connection loss * Screenshot saving + Basically, merged previous `Avatar Change Info` and `Server Connection Info` mods in one. # Installation From 705d026d177bbe2edf6065b65aa1fbaf645105f5 Mon Sep 17 00:00:00 2001 From: SDraw Date: Wed, 8 Mar 2023 17:57:22 +0000 Subject: [PATCH 09/11] Hips rotation restore --- ml_amt/Properties/AssemblyInfo.cs | 2 +- ml_amt/README.md | 7 ++- ml_amt/ml_amt.csproj | 2 +- ml_dht/Properties/AssemblyInfo.cs | 2 +- ml_dht/ml_dht.csproj | 2 +- ml_drs/Properties/AssemblyInfo.cs | 8 +-- ml_drs/ml_drs.csproj | 95 ++++++++++++------------------- ml_drs/ml_drs.csproj.user | 6 -- ml_egn/Properties/AssemblyInfo.cs | 2 +- ml_egn/ml_egn.csproj | 2 +- ml_lme/LeapTracked.cs | 2 + ml_lme/Properties/AssemblyInfo.cs | 2 +- ml_lme/ml_lme.csproj | 2 +- ml_pam/Properties/AssemblyInfo.cs | 2 +- ml_pam/ml_pam.csproj | 2 +- 15 files changed, 52 insertions(+), 86 deletions(-) delete mode 100644 ml_drs/ml_drs.csproj.user diff --git a/ml_amt/Properties/AssemblyInfo.cs b/ml_amt/Properties/AssemblyInfo.cs index eaafb9a..dc4df48 100644 --- a/ml_amt/Properties/AssemblyInfo.cs +++ b/ml_amt/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.2.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.2.4-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_amt/README.md b/ml_amt/README.md index c49dd7d..b717c77 100644 --- a/ml_amt/README.md +++ b/ml_amt/README.md @@ -28,9 +28,10 @@ Available mod's settings in `Settings - IK - Avatar Motion Tweaker`: * Note: Created as example for [propoused game feature](https://feedback.abinteractive.net/p/disabling-vr-ik-for-emotes-via-animator-state-tag-7b80d963-053a-41c0-86ac-e3d53c61c1e2). * **Adjusted locomotion mass center:** automatically changes IK locomotion center if avatar has toe bones; default value - `true`. * Note: Compatible with [DesktopVRIK](https://github.com/NotAKidOnSteam/DesktopVRIK) and [FuckToes](https://github.com/NotAKidOnSteam/FuckToes). -* **Alternative avatar collider scale:** applies slightly different approach to avatar collider size change; default value - `true` -* **Prevent Unity animation override:** disables overriding of animations at runtime for avatars with AAS; default value - `false`. - * Note: This options is made for "fix" of [broken animator issues with chairs and combat worlds](https://feedback.abinteractive.net/p/gestures-getting-stuck-locally-upon-entering-vehicles-chairs). +* **Scaled locomotion steps:** scales VRIK locomotion steps according to avatar height and scale; default value - `true`. +* **Alternative avatar collider scale:** applies slightly different approach to avatar collider size change; default value - `true`. +* **Fix animation overrides (chairs, etc.):** fixes animations overriding for avatars with AAS; default value - `true`. + * Note: This options is made to address [broken animator in chairs and combat worlds issue](https://feedback.abinteractive.net/p/gestures-getting-stuck-locally-upon-entering-vehicles-chairs). Available additional parameters for AAS animator: * **`Upright`:** defines linear coefficient between current viewpoint height and avatar's viewpoint height; float, range - [0.0, 1.0]. diff --git a/ml_amt/ml_amt.csproj b/ml_amt/ml_amt.csproj index 50899c6..d3318ed 100644 --- a/ml_amt/ml_amt.csproj +++ b/ml_amt/ml_amt.csproj @@ -6,7 +6,7 @@ None AvatarMotionTweaker AvatarMotionTweaker - 1.2.3 + 1.2.4 x64 ml_amt diff --git a/ml_dht/Properties/AssemblyInfo.cs b/ml_dht/Properties/AssemblyInfo.cs index 84eafec..a4c8fbf 100644 --- a/ml_dht/Properties/AssemblyInfo.cs +++ b/ml_dht/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.1.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.1.2-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_dht/ml_dht.csproj b/ml_dht/ml_dht.csproj index c180073..32ef990 100644 --- a/ml_dht/ml_dht.csproj +++ b/ml_dht/ml_dht.csproj @@ -6,7 +6,7 @@ SDraw None DesktopHeadTracking - 1.1.1 + 1.1.2 x64 diff --git a/ml_drs/Properties/AssemblyInfo.cs b/ml_drs/Properties/AssemblyInfo.cs index 36e4ddb..3e29b95 100644 --- a/ml_drs/Properties/AssemblyInfo.cs +++ b/ml_drs/Properties/AssemblyInfo.cs @@ -1,10 +1,4 @@ -using System.Reflection; - -[assembly: AssemblyTitle("DesktopReticleSwitch")] -[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.0.0")] - -[assembly: MelonLoader.MelonInfo(typeof(ml_drs.DesktopReticleSwitch), "DesktopReticleSwitch", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_drs.DesktopReticleSwitch), "DesktopReticleSwitch", "1.0.1-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_drs/ml_drs.csproj b/ml_drs/ml_drs.csproj index 41b71ab..b1153cc 100644 --- a/ml_drs/ml_drs.csproj +++ b/ml_drs/ml_drs.csproj @@ -1,74 +1,49 @@ - - - + + - Debug - AnyCPU - {06CD5155-4459-48C3-8A53-E0B91136351B} - Library - Properties - ml_drs - ml_drs - v4.7.2 - 512 - true + netstandard2.1 + x64 + DesktopReticleSwitch + DesktopReticleSwitch + SDraw + None + 1.0.1 - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset + + + none + false + - - False - False + + + + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false - C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll - False - - - C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll - False + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll + false - C:\Games\Steam\common\ChilloutVR\MelonLoader\MelonLoader.dll - False + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll + false - - - - - - - - False + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false - C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll - False + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll + false - - - - - - - copy /y "$(TargetPath)" "C:\Games\Steam\common\ChilloutVR\Mods\" - - \ No newline at end of file + + + + + + diff --git a/ml_drs/ml_drs.csproj.user b/ml_drs/ml_drs.csproj.user deleted file mode 100644 index 2539084..0000000 --- a/ml_drs/ml_drs.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - C:\Games\Steam\common\ChilloutVR\MelonLoader\;C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\ - - \ No newline at end of file diff --git a/ml_egn/Properties/AssemblyInfo.cs b/ml_egn/Properties/AssemblyInfo.cs index 81075ea..7a56a6b 100644 --- a/ml_egn/Properties/AssemblyInfo.cs +++ b/ml_egn/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_egn.ExtendedGameNotifications), "ExtendedGameNotifications", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_egn.ExtendedGameNotifications), "ExtendedGameNotifications", "1.0.2-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_egn/ml_egn.csproj b/ml_egn/ml_egn.csproj index 1bde6ae..6441a3f 100644 --- a/ml_egn/ml_egn.csproj +++ b/ml_egn/ml_egn.csproj @@ -4,7 +4,7 @@ netstandard2.1 x64 ExtendedGameNotifications - 1.0.1 + 1.0.2 SDraw None ExtendedGameNotifications diff --git a/ml_lme/LeapTracked.cs b/ml_lme/LeapTracked.cs index 3c66318..7c8cfea 100644 --- a/ml_lme/LeapTracked.cs +++ b/ml_lme/LeapTracked.cs @@ -129,12 +129,14 @@ namespace ml_lme GestureMatcher.LeapData l_data = LeapManager.GetInstance().GetLatestData(); Vector3 l_hipsLocalPos = m_hips.localPosition; + Quaternion l_hipsLocalRot = m_hips.localRotation; m_poseHandler.GetHumanPose(ref m_pose); UpdateFingers(l_data); m_poseHandler.SetHumanPose(ref m_pose); m_hips.localPosition = l_hipsLocalPos; + m_hips.localRotation = l_hipsLocalRot; } } diff --git a/ml_lme/Properties/AssemblyInfo.cs b/ml_lme/Properties/AssemblyInfo.cs index 2ba92f2..6599485 100644 --- a/ml_lme/Properties/AssemblyInfo.cs +++ b/ml_lme/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.2-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_lme/ml_lme.csproj b/ml_lme/ml_lme.csproj index 9ee47f9..bd5702a 100644 --- a/ml_lme/ml_lme.csproj +++ b/ml_lme/ml_lme.csproj @@ -4,7 +4,7 @@ netstandard2.1 x64 LeapMotionExtension - 1.3.1 + 1.3.2 SDraw None LeapMotionExtension diff --git a/ml_pam/Properties/AssemblyInfo.cs b/ml_pam/Properties/AssemblyInfo.cs index 45107f1..4e400ae 100644 --- a/ml_pam/Properties/AssemblyInfo.cs +++ b/ml_pam/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.2-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPriority(1)] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] diff --git a/ml_pam/ml_pam.csproj b/ml_pam/ml_pam.csproj index a591cc9..83de615 100644 --- a/ml_pam/ml_pam.csproj +++ b/ml_pam/ml_pam.csproj @@ -4,7 +4,7 @@ netstandard2.1 x64 PickupArmMovement - 1.0.1 + 1.0.2 SDraw None PickupArmMovement From cae6a8a19c3acfa69c6691da0049c9d267c20689 Mon Sep 17 00:00:00 2001 From: SDraw Date: Thu, 9 Mar 2023 23:32:52 +0300 Subject: [PATCH 10/11] Funny CSharp with structures and properties --- ml_lme/Settings.cs | 54 ++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/ml_lme/Settings.cs b/ml_lme/Settings.cs index 2ebbaa6..a28ee48 100644 --- a/ml_lme/Settings.cs +++ b/ml_lme/Settings.cs @@ -209,60 +209,78 @@ namespace ml_lme { case ModSetting.DesktopX: { - DesktopOffset.Set(int.Parse(p_value) * 0.01f, DesktopOffset.y, DesktopOffset.z); - DesktopOffsetChange?.Invoke(DesktopOffset); + Vector3 l_current = DesktopOffset; + l_current.x = int.Parse(p_value) * 0.01f; + DesktopOffset = l_current; + DesktopOffsetChange?.Invoke(l_current); } break; case ModSetting.DesktopY: { - DesktopOffset.Set(DesktopOffset.x, int.Parse(p_value) * 0.01f, DesktopOffset.z); - DesktopOffsetChange?.Invoke(DesktopOffset); + Vector3 l_current = DesktopOffset; + l_current.y = int.Parse(p_value) * 0.01f; + DesktopOffset = l_current; + DesktopOffsetChange?.Invoke(l_current); } break; case ModSetting.DesktopZ: { - DesktopOffset.Set(DesktopOffset.x, DesktopOffset.y, int.Parse(p_value) * 0.01f); - DesktopOffsetChange?.Invoke(DesktopOffset); + Vector3 l_current = DesktopOffset; + l_current.z = int.Parse(p_value) * 0.01f; + DesktopOffset = l_current; + DesktopOffsetChange?.Invoke(l_current); } break; case ModSetting.AngleX: { - RootAngle.Set(int.Parse(p_value), RootAngle.y, RootAngle.z); - RootAngleChange?.Invoke(RootAngle); + Vector3 l_current = RootAngle; + l_current.x = int.Parse(p_value); + RootAngle = l_current; + RootAngleChange?.Invoke(l_current); } break; case ModSetting.AngleY: { - RootAngle.Set(RootAngle.x, int.Parse(p_value), RootAngle.z); - RootAngleChange?.Invoke(RootAngle); + Vector3 l_current = RootAngle; + l_current.y = int.Parse(p_value); + RootAngle = l_current; + RootAngleChange?.Invoke(l_current); } break; case ModSetting.AngleZ: { - RootAngle.Set(RootAngle.x, RootAngle.y, int.Parse(p_value)); - RootAngleChange?.Invoke(RootAngle); + Vector3 l_current = RootAngle; + l_current.z = int.Parse(p_value); + RootAngle = l_current; + RootAngleChange?.Invoke(l_current); } break; case ModSetting.HeadX: { - HeadOffset.Set(int.Parse(p_value) * 0.01f, HeadOffset.y, HeadOffset.z); - HeadOffsetChange?.Invoke(HeadOffset); + Vector3 l_current = HeadOffset; + l_current.x = int.Parse(p_value) * 0.01f; + HeadOffset = l_current; + HeadOffsetChange?.Invoke(l_current); } break; case ModSetting.HeadY: { - HeadOffset.Set(HeadOffset.x, int.Parse(p_value) * 0.01f, HeadOffset.z); - HeadOffsetChange?.Invoke(HeadOffset); + Vector3 l_current = HeadOffset; + l_current.y = int.Parse(p_value) * 0.01f; + HeadOffset = l_current; + HeadOffsetChange?.Invoke(l_current); } break; case ModSetting.HeadZ: { - HeadOffset.Set(HeadOffset.x, HeadOffset.y, int.Parse(p_value) * 0.01f); - HeadOffsetChange?.Invoke(HeadOffset); + Vector3 l_current = HeadOffset; + l_current.z = int.Parse(p_value) * 0.01f; + HeadOffset = l_current; + HeadOffsetChange?.Invoke(l_current); } break; case ModSetting.InteractThreadhold: From c90119e20aac053db069353d55904779e3760b62 Mon Sep 17 00:00:00 2001 From: SDraw Date: Thu, 16 Mar 2023 09:23:22 +0300 Subject: [PATCH 11/11] Finger tracking sync only if hands are tracked --- ml_lme/LeapInput.cs | 18 ++++++++++++------ ml_lme/Utils.cs | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ml_lme/LeapInput.cs b/ml_lme/LeapInput.cs index 2affd0a..cd6414b 100644 --- a/ml_lme/LeapInput.cs +++ b/ml_lme/LeapInput.cs @@ -11,8 +11,6 @@ namespace ml_lme [DisallowMultipleComponent] class LeapInput : CVRInputModule { - static readonly FieldInfo ms_indexGestureToggle = typeof(InputModuleOpenXR).GetField("_steamVrIndexGestureToggleValue", BindingFlags.Instance | BindingFlags.NonPublic); - CVRInputManager m_inputManager = null; InputModuleOpenXR m_openXrModule = null; bool m_inVR = false; @@ -123,8 +121,18 @@ namespace ml_lme { if(l_data.m_leftHand.m_present) SetFingersInput(l_data.m_leftHand, true); + if(l_data.m_rightHand.m_present) SetFingersInput(l_data.m_rightHand, false); + + if(m_inVR) + { + m_inputManager.individualFingerTracking = !m_openXrModule.GetIndexGestureToggle(); + m_inputManager.individualFingerTracking |= (l_data.m_leftHand.m_present || l_data.m_rightHand.m_present); + } + else + m_inputManager.individualFingerTracking = (l_data.m_leftHand.m_present || l_data.m_rightHand.m_present); + IKSystem.Instance.FingerSystem.controlActive = m_inputManager.individualFingerTracking; } m_handRayLeft.enabled = (l_data.m_leftHand.m_present && (!m_inVR || !Utils.IsLeftHandTracked() || !Settings.FingersOnly)); @@ -240,15 +248,12 @@ namespace ml_lme // Arbitrary void UpdateFingerTracking() { - m_inputManager.individualFingerTracking = (Settings.Enabled || (m_inVR && m_openXrModule.AreKnucklesInUse() && !(bool)ms_indexGestureToggle.GetValue(m_openXrModule))); + m_inputManager.individualFingerTracking = (Settings.Enabled || (m_inVR && m_openXrModule.AreKnucklesInUse() && !m_openXrModule.GetIndexGestureToggle())); IKSystem.Instance.FingerSystem.controlActive = m_inputManager.individualFingerTracking; } void SetFingersInput(GestureMatcher.HandData p_hand, bool p_left) { - m_inputManager.individualFingerTracking = true; - IKSystem.Instance.FingerSystem.controlActive = true; - if(p_left) { m_inputManager.fingerCurlLeftThumb = p_hand.m_bends[0]; @@ -267,6 +272,7 @@ namespace ml_lme } } + // Game settings void OnGameSettingBoolChange(string p_name, bool p_state) { if(p_name == "ControlUseGripToGrab") diff --git a/ml_lme/Utils.cs b/ml_lme/Utils.cs index 26bb9b8..3757395 100644 --- a/ml_lme/Utils.cs +++ b/ml_lme/Utils.cs @@ -12,11 +12,14 @@ namespace ml_lme static readonly Quaternion ms_screentopRotationFix = new Quaternion(0f, 0f, -1f, 0f); static readonly FieldInfo ms_leftControllerName = typeof(InputModuleOpenXR).GetField("_leftHandControllerName", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_rightControllerName = typeof(InputModuleOpenXR).GetField("_rightHandControllerName", BindingFlags.NonPublic | BindingFlags.Instance); + static readonly FieldInfo ms_indexGestureToggle = typeof(InputModuleOpenXR).GetField("_steamVrIndexGestureToggleValue", BindingFlags.Instance | BindingFlags.NonPublic); public static bool IsInVR() => ((CheckVR.Instance != null) && CheckVR.Instance.hasVrDeviceLoaded); public static bool AreKnucklesInUse(this InputModuleOpenXR p_module) => (((string)ms_leftControllerName.GetValue(p_module)).Contains("Index") || ((string)ms_rightControllerName.GetValue(p_module)).Contains("Index")); + public static bool GetIndexGestureToggle(this InputModuleOpenXR p_module) => (bool)ms_indexGestureToggle.GetValue(p_module); public static bool IsLeftHandTracked() => InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).isValid; public static bool IsRightHandTracked() => InputDevices.GetDeviceAtXRNode(XRNode.RightHand).isValid; + public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false) {