diff --git a/DesktopVRIK/BTKUI_Integration/BTKUI_Integration.cs b/DesktopVRIK/BTKUI_Integration/BTKUI_Integration.cs deleted file mode 100644 index ed962e7..0000000 --- a/DesktopVRIK/BTKUI_Integration/BTKUI_Integration.cs +++ /dev/null @@ -1,46 +0,0 @@ -using BTKUILib; -using BTKUILib.UIObjects; -using System.Runtime.CompilerServices; - -namespace NAK.Melons.DesktopVRIK.BTKUI_Integration; - -public static class BTKUI_Integration -{ - [MethodImpl(MethodImplOptions.NoInlining)] - public static void Init() - { - //Add myself to the Misc Menu - - Page miscPage = QuickMenuAPI.MiscTabPage; - Category miscCategory = miscPage.AddCategory("DesktopVRIK"); - - var setting_Enabled = miscCategory.AddToggle(DesktopVRIKMod.m_entryEnabled.DisplayName, DesktopVRIKMod.m_entryEnabled.Description, DesktopVRIKMod.m_entryEnabled.Value); - setting_Enabled.OnValueUpdated += b => DesktopVRIKMod.m_entryEnabled.Value = b; - - //Add my own page to not clog up Misc Menu - - Page desktopVRIKPage = miscCategory.AddPage("DesktopVRIK Settings", "", "Configure the settings for DesktopVRIK.", "DesktopVRIK"); - desktopVRIKPage.MenuTitle = "DesktopVRIK Settings"; - desktopVRIKPage.MenuSubtitle = "Simplified settings for VRIK on Desktop."; - - Category desktopVRIKCategory = desktopVRIKPage.AddCategory("DesktopVRIK"); - - var setting_Enabled_2 = desktopVRIKCategory.AddToggle(DesktopVRIKMod.m_entryEnabled.DisplayName, DesktopVRIKMod.m_entryEnabled.Description, DesktopVRIKMod.m_entryEnabled.Value); - setting_Enabled_2.OnValueUpdated += b => DesktopVRIKMod.m_entryEnabled.Value = b; - - var setting_EnforceViewPosition = desktopVRIKCategory.AddToggle(DesktopVRIKMod.m_entryEnforceViewPosition.DisplayName, DesktopVRIKMod.m_entryEnforceViewPosition.Description, DesktopVRIKMod.m_entryEnforceViewPosition.Value); - setting_EnforceViewPosition.OnValueUpdated += b => DesktopVRIKMod.m_entryEnforceViewPosition.Value = b; - - var setting_DisableEmoteVRIK = desktopVRIKCategory.AddToggle(DesktopVRIKMod.m_entryEmoteVRIK.DisplayName, DesktopVRIKMod.m_entryEmoteVRIK.Description, DesktopVRIKMod.m_entryEmoteVRIK.Value); - setting_DisableEmoteVRIK.OnValueUpdated += b => DesktopVRIKMod.m_entryEmoteVRIK.Value = b; - - var setting_DisableEmoteLookAtIK = desktopVRIKCategory.AddToggle(DesktopVRIKMod.m_entryEmoteLookAtIK.DisplayName, DesktopVRIKMod.m_entryEmoteLookAtIK.Description, DesktopVRIKMod.m_entryEmoteLookAtIK.Value); - setting_DisableEmoteLookAtIK.OnValueUpdated += b => DesktopVRIKMod.m_entryEmoteLookAtIK.Value = b; - - var setting_BodyLeanWeight = desktopVRIKPage.AddSlider(DesktopVRIKMod.m_entryBodyLeanWeight.DisplayName, DesktopVRIKMod.m_entryBodyLeanWeight.Description, DesktopVRIKMod.m_entryBodyLeanWeight.Value, 0f, 1f, 1); - setting_BodyLeanWeight.OnValueUpdated += f => DesktopVRIKMod.m_entryBodyLeanWeight.Value = f; - - var setting_BodyAngleLimit = desktopVRIKPage.AddSlider(DesktopVRIKMod.m_entryBodyAngleLimit.DisplayName, DesktopVRIKMod.m_entryBodyAngleLimit.Description, DesktopVRIKMod.m_entryBodyAngleLimit.Value, 0f, 90f, 0); - setting_BodyAngleLimit.OnValueUpdated += f => DesktopVRIKMod.m_entryBodyAngleLimit.Value = f; - } -} \ No newline at end of file diff --git a/DesktopVRIK/DesktopVRIK.cs b/DesktopVRIK/DesktopVRIK.cs index 4de314b..5e73a26 100644 --- a/DesktopVRIK/DesktopVRIK.cs +++ b/DesktopVRIK/DesktopVRIK.cs @@ -17,12 +17,11 @@ public class DesktopVRIK : MonoBehaviour Setting_Enabled, Setting_EnforceViewPosition, Setting_EmoteVRIK, - Setting_EmoteLookAtIK, - Setting_Internal_PlantFeet = true; + Setting_EmoteLookAtIK; public static float - Setting_BodyLeanWeight = 0.3f, - Setting_BodyAngleLimit = 45f; + Setting_BodyLeanWeight = 0.5f, + Setting_BodyAngleLimit = 0f; public Transform viewpoint; public Vector3 eyeOffset; @@ -46,14 +45,15 @@ public class DesktopVRIK : MonoBehaviour public void AlternativeOnPreSolverUpdate() { - //set IK offsets (this is a really fucking weird way to do this) + //this order matters, rotation offset will be choppy if avatar is not cenetered first + DesktopVRIK_Helper.Instance?.OnUpdateVRIK(); //Reset avatar offset (VRIK will literally make you walk away from root otherwise) IKSystem.vrik.transform.localPosition = Vector3.zero; IKSystem.vrik.transform.localRotation = Quaternion.identity; - IKSystem.vrik.solver.plantFeet = Setting_Internal_PlantFeet; + IKSystem.vrik.solver.plantFeet = true; } public Animator animator; @@ -79,17 +79,27 @@ public class DesktopVRIK : MonoBehaviour animator.Update(0f); } - //Generic VRIK calibration shit VRIK vrik = avatar.gameObject.AddComponent(); vrik.AutoDetectReferences(); + //fuck toes + vrik.references.leftToes = null; + vrik.references.rightToes = null; + vrik.fixTransforms = true; vrik.solver.plantFeet = false; - vrik.solver.locomotion.weight = 0f; vrik.solver.locomotion.angleThreshold = 30f; vrik.solver.locomotion.maxLegStretch = 0.75f; - //nuke weights - vrik.solver.spine.minHeadHeight = 0f; + vrik.solver.spine.minHeadHeight = -100f; + + vrik.solver.spine.bodyRotStiffness = 0.15f; + vrik.solver.spine.headClampWeight = 1f; + vrik.solver.spine.maintainPelvisPosition = 1f; + vrik.solver.spine.neckStiffness = 0f; + + vrik.solver.locomotion.weight = 0f; + vrik.solver.spine.bodyPosStiffness = 0f; + vrik.solver.spine.positionWeight = 0f; vrik.solver.spine.pelvisPositionWeight = 0f; vrik.solver.leftArm.positionWeight = 0f; vrik.solver.leftArm.rotationWeight = 0f; @@ -101,27 +111,11 @@ public class DesktopVRIK : MonoBehaviour vrik.solver.rightLeg.rotationWeight = 0f; vrik.solver.IKPositionWeight = 0f; - //calm ur ass - vrik.solver.spine.positionWeight = 0f; - - - //related to body & head rotation offset/limit - vrik.solver.spine.headClampWeight = 1f; - vrik.solver.spine.bodyRotStiffness = 0.8f; - //makes chest between feet and head direction - vrik.solver.spine.chestClampWeight = 0.5f; - //needed to make head 1:1 with camera still - vrik.solver.spine.neckStiffness = 1f; - - - //ChilloutVR specific BodySystem.TrackingLeftArmEnabled = false; BodySystem.TrackingRightArmEnabled = false; BodySystem.TrackingLeftLegEnabled = false; BodySystem.TrackingRightLegEnabled = false; BodySystem.TrackingPositionWeight = 0f; - IKSystem.Instance.headAnchorRotationOffset = Vector3.zero; - IKSystem.Instance.headAnchorPositionOffset = Vector3.zero; //Custom funky AF head ik shit foreach (Transform transform in DesktopVRIK_Helper.Instance.ik_HeadFollower) diff --git a/DesktopVRIK/DesktopVRIK_Helper.cs b/DesktopVRIK/DesktopVRIK_Helper.cs index bcab58f..ae4f433 100644 --- a/DesktopVRIK/DesktopVRIK_Helper.cs +++ b/DesktopVRIK/DesktopVRIK_Helper.cs @@ -51,7 +51,7 @@ internal class DesktopVRIK_Helper : MonoBehaviour globalWeight *= IKSystem.vrik.solver.locomotion.weight; //the most important thing ever - IKSystem.vrik.solver.spine.rotationWeight = globalWeight; + //IKSystem.vrik.solver.spine.rotationWeight = globalWeight; HeadIK_FollowPosition(); diff --git a/DesktopVRIK/HarmonyPatches.cs b/DesktopVRIK/HarmonyPatches.cs index 6925207..2a9a6b1 100644 --- a/DesktopVRIK/HarmonyPatches.cs +++ b/DesktopVRIK/HarmonyPatches.cs @@ -139,7 +139,7 @@ class IKSystemPatches ____poseHandler.SetHumanPose(ref ___humanPose); ____vrik = DesktopVRIK.Instance.AlternativeCalibration(avatar); - IKSystem.Instance.ApplyAvatarScaleToIk(avatar.viewPosition.y); + IKSystem.Instance.ApplyAvatarScaleToIk(avatar.viewPosition.y); } } } diff --git a/DesktopVRIK/Integrations/BTKUIAddon.cs b/DesktopVRIK/Integrations/BTKUIAddon.cs new file mode 100644 index 0000000..e2ab2ab --- /dev/null +++ b/DesktopVRIK/Integrations/BTKUIAddon.cs @@ -0,0 +1,48 @@ +using BTKUILib; +using BTKUILib.UIObjects; +using System.Runtime.CompilerServices; + +namespace NAK.Melons.DesktopVRIK; + +public static class BTKUIAddon +{ + [MethodImpl(MethodImplOptions.NoInlining)] + public static void Init() + { + //Add myself to the Misc Menu + + Page miscPage = QuickMenuAPI.MiscTabPage; + Category miscCategory = miscPage.AddCategory(DesktopVRIKMod.SettingsCategory); + + AddMelonToggle(ref miscCategory, DesktopVRIKMod.m_entryEnabled); + + //Add my own page to not clog up Misc Menu + + Page desktopVRIKPage = miscCategory.AddPage("DesktopVRIK Settings", "", "Configure the settings for DesktopVRIK.", "DesktopVRIK"); + desktopVRIKPage.MenuTitle = "DesktopVRIK Settings"; + desktopVRIKPage.MenuSubtitle = "Simplified settings for VRIK on Desktop."; + + Category desktopVRIKCategory = desktopVRIKPage.AddCategory("DesktopVRIK"); + + AddMelonToggle(ref desktopVRIKCategory, DesktopVRIKMod.m_entryEnabled); + + AddMelonToggle(ref desktopVRIKCategory, DesktopVRIKMod.m_entryEnforceViewPosition); + + AddMelonToggle(ref desktopVRIKCategory, DesktopVRIKMod.m_entryEmoteVRIK); + + AddMelonToggle(ref desktopVRIKCategory, DesktopVRIKMod.m_entryEmoteLookAtIK); + + AddMelonSlider(ref desktopVRIKPage, DesktopVRIKMod.m_entryBodyLeanWeight, 0, 1f); + + AddMelonSlider(ref desktopVRIKPage, DesktopVRIKMod.m_entryBodyAngleLimit, 0, 90f); + } + private static void AddMelonToggle(ref Category category, MelonLoader.MelonPreferences_Entry entry) + { + category.AddToggle(entry.DisplayName, entry.Description, entry.Value).OnValueUpdated += b => entry.Value = b; + } + + private static void AddMelonSlider(ref Page page, MelonLoader.MelonPreferences_Entry entry, float min, float max) + { + page.AddSlider(entry.DisplayName, entry.Description, entry.Value, min, max).OnValueUpdated += f => entry.Value = f; + } +} \ No newline at end of file diff --git a/DesktopVRIK/Main.cs b/DesktopVRIK/Main.cs index 23644b2..524f85b 100644 --- a/DesktopVRIK/Main.cs +++ b/DesktopVRIK/Main.cs @@ -11,9 +11,8 @@ public class DesktopVRIKMod : MelonMod internal static MelonPreferences_Entry m_entryEnabled, m_entryEnforceViewPosition, m_entryEmoteVRIK, - m_entryEmoteLookAtIK, - m_entryAllowRootSlipping; - internal static MelonPreferences_Entry + m_entryEmoteLookAtIK; + internal static MelonPreferences_Entry m_entryBodyLeanWeight, m_entryBodyAngleLimit; public override void OnInitializeMelon() @@ -24,8 +23,8 @@ public class DesktopVRIKMod : MelonMod m_entryEmoteVRIK = m_categoryDesktopVRIK.CreateEntry("Disable Emote VRIK", true, description: "Disable VRIK while emoting. Only disable if you are ok with looking dumb."); m_entryEmoteLookAtIK = m_categoryDesktopVRIK.CreateEntry("Disable Emote LookAtIK", true, description: "Disable LookAtIK while emoting. This setting doesn't really matter, as LookAtIK isn't networked while doing an emote."); - m_entryBodyLeanWeight = m_categoryDesktopVRIK.CreateEntry("Body Lean Weight", 0.3f, description: "Emulates old VRChat-like body leaning when looking up/down. Set to 0 to disable."); - m_entryBodyAngleLimit = m_categoryDesktopVRIK.CreateEntry("Body Angle Limit", 45f, description: "Emulates VRChat-like body and head offset when rotating left/right. Set to 0 to disable."); + m_entryBodyLeanWeight = m_categoryDesktopVRIK.CreateEntry("Body Lean Weight", 0.5f, description: "Emulates old VRChat-like body leaning when looking up/down. Set to 0 to disable."); + m_entryBodyAngleLimit = m_categoryDesktopVRIK.CreateEntry("Body Angle Limit", 0f, description: "Emulates VRChat-like body and head offset when rotating left/right. Set to 0 to disable. (this setting only affects the feet due to chillout not setting up the player controller for VRIK)"); foreach (var setting in m_categoryDesktopVRIK.Entries) { @@ -36,7 +35,7 @@ public class DesktopVRIKMod : MelonMod if (MelonMod.RegisteredMelons.Any(it => it.Info.Name == "BTKUILib")) { MelonLogger.Msg("Initializing BTKUILib support."); - BTKUI_Integration.BTKUI_Integration.Init(); + BTKUIAddon.Init(); } //Apply patches (i stole) diff --git a/DesktopVRIK/format.json b/DesktopVRIK/format.json index d145c52..c7ab85f 100644 --- a/DesktopVRIK/format.json +++ b/DesktopVRIK/format.json @@ -1,7 +1,7 @@ { "_id": 117, "name": "DesktopVRIK", - "modversion": "2.0.2", + "modversion": "2.0.3", "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", @@ -14,10 +14,10 @@ "feet" ], "requirements": [ - "None" + "BTKUILib" ], - "downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v2.0.2/DesktopVRIK.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v2.0.3/DesktopVRIK.dll", "sourcelink": "https://github.com/NotAKidOnSteam/DesktopVRIK/", - "changelog": "- Fixed butt from slipping out underneath you and thrusting when leaning.\n- Fixed VRIK bleeding into locomotion animations.", + "changelog": "- Tweaks to VRIK settings so BetterInteractDesktop & PickupArmMovement better behave alongside VRIK.\n- Tweaks to BTKUI integration.", "embedcolor": "9b59b6" } \ No newline at end of file