From cbfc1f39b6f0cf1ec52a0d2c4c269abe3992642e Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Tue, 16 May 2023 22:19:53 -0500 Subject: [PATCH] [DesktopVRIK] No toes & Testing --- DesktopVRIK/DesktopVRIKSystem.cs | 15 ++++++--- DesktopVRIK/Integrations/BTKUIAddon.cs | 4 ++- DesktopVRIK/Main.cs | 6 +--- DesktopVRIK/VRIKUtils.cs | 46 ++------------------------ 4 files changed, 17 insertions(+), 54 deletions(-) diff --git a/DesktopVRIK/DesktopVRIKSystem.cs b/DesktopVRIK/DesktopVRIKSystem.cs index 98bf02d..6fdbb4c 100644 --- a/DesktopVRIK/DesktopVRIKSystem.cs +++ b/DesktopVRIK/DesktopVRIKSystem.cs @@ -516,10 +516,10 @@ internal class DesktopVRIKSystem : MonoBehaviour avatarVRIK.AutoDetectReferences(); avatarIKSolver = avatarVRIK.solver; - VRIKUtils.ConfigureVRIKReferences(avatarVRIK, Setting_UseVRIKToes, Setting_FindUnmappedToes, out bool foundUnmappedToes); + VRIKUtils.ConfigureVRIKReferences(avatarVRIK, Setting_UseVRIKToes); - // Fix animator issue or non-human mapped toes - avatarVRIK.fixTransforms = _vrikFixTransformsRequired || foundUnmappedToes; + // Fix animator issue + avatarVRIK.fixTransforms = _vrikFixTransformsRequired; // Default solver settings avatarIKSolver.locomotion.weight = 0f; @@ -531,16 +531,21 @@ internal class DesktopVRIKSystem : MonoBehaviour avatarIKSolver.spine.maintainPelvisPosition = 0f; // Body leaning settings - avatarIKSolver.spine.neckStiffness = 0.0001f; avatarIKSolver.spine.bodyPosStiffness = 1f; avatarIKSolver.spine.bodyRotStiffness = 0.2f; + // this is a hack, allows chest to rotate slightly + // independent from hip rotation. Funny Spine.Solve()->Bend() + avatarIKSolver.spine.neckStiffness = 0.0001f; // Disable locomotion + // Setting velocity to 0 aleviated nameplate jitter issue on remote avatarIKSolver.locomotion.velocityFactor = 0f; avatarIKSolver.locomotion.maxVelocity = 0f; avatarIKSolver.locomotion.rootSpeed = 1000f; // Disable chest rotation by hands + // this fixed Effector, Player Arm Movement, BetterInteractDesktop, ect + // from making entire body shake, as well as while running avatarIKSolver.spine.rotateChestByHands = 0f; // Prioritize LookAtIK @@ -552,6 +557,8 @@ internal class DesktopVRIKSystem : MonoBehaviour // Set so emotes play properly avatarIKSolver.spine.maxRootAngle = 180f; + // this is different in VR, as CVR player controller is not set up optimally for VRIK. + // Desktop avatar rotates 1:1 with _PlayerLocal. VR has a disconnect because you can turn IRL. // We disable these ourselves now, as we no longer use BodySystem avatarIKSolver.spine.maintainPelvisPosition = 1f; diff --git a/DesktopVRIK/Integrations/BTKUIAddon.cs b/DesktopVRIK/Integrations/BTKUIAddon.cs index 6d13f0d..45cfa3e 100644 --- a/DesktopVRIK/Integrations/BTKUIAddon.cs +++ b/DesktopVRIK/Integrations/BTKUIAddon.cs @@ -26,11 +26,13 @@ public static class BTKUIAddon // Calibration Settings AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryUseVRIKToes); - AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryFindUnmappedToes); // Fine-tuning Settings AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryResetFootstepsOnIdle); + // Funny Settings + AddMelonToggle(ref desktopVRIKCategory, DesktopVRIK.EntryProneThrusting); + // Body Leaning Weight AddMelonSlider(ref desktopVRIKPage, DesktopVRIK.EntryBodyLeanWeight, 0, 1f, 1); diff --git a/DesktopVRIK/Main.cs b/DesktopVRIK/Main.cs index 0239aaf..bb72dae 100644 --- a/DesktopVRIK/Main.cs +++ b/DesktopVRIK/Main.cs @@ -23,9 +23,6 @@ public class DesktopVRIK : MelonMod public static readonly MelonPreferences_Entry EntryUseVRIKToes = CategoryDesktopVRIK.CreateEntry("Use VRIK Toes", false, description: "Determines if VRIK uses humanoid toes for IK solving, which can cause feet to idle behind the avatar."); - public static readonly MelonPreferences_Entry EntryFindUnmappedToes = - CategoryDesktopVRIK.CreateEntry("Find Unmapped Toes", false, description: "Determines if DesktopVRIK should look for unmapped toe bones if the humanoid rig does not have any."); - public static readonly MelonPreferences_Entry EntryBodyLeanWeight = CategoryDesktopVRIK.CreateEntry("Body Lean Weight", 0.5f, description: "Adds rotational influence to the body solver when looking up/down. Set to 0 to disable."); @@ -42,7 +39,7 @@ public class DesktopVRIK : MelonMod CategoryDesktopVRIK.CreateEntry("IK Lerp Speed", 10f, description: "Determines fast the IK & Locomotion weights blend after entering idle. Set to 0 to disable."); public static readonly MelonPreferences_Entry EntryProneThrusting = - CategoryDesktopVRIK.CreateEntry("Prone Thrusting", false, description: "Allows Body Lean Weight to take affect while crouched or prone."); + CategoryDesktopVRIK.CreateEntry("Prone Thrusting", false, description: "Allows Body Lean Weight to take effect while crouched or prone."); public static readonly MelonPreferences_Entry EntryIntegrationAMT = CategoryDesktopVRIK.CreateEntry("AMT Integration", true, description: "Relies on AvatarMotionTweaker to handle VRIK Locomotion weights if available."); @@ -92,7 +89,6 @@ public class DesktopVRIK : MelonMod // Calibration Settings DesktopVRIKSystem.Instance.Setting_UseVRIKToes = EntryUseVRIKToes.Value; - DesktopVRIKSystem.Instance.Setting_FindUnmappedToes = EntryFindUnmappedToes.Value; // Fine-tuning Settings DesktopVRIKSystem.Instance.Setting_ResetFootsteps = EntryResetFootstepsOnIdle.Value; diff --git a/DesktopVRIK/VRIKUtils.cs b/DesktopVRIK/VRIKUtils.cs index f52245a..4850b4d 100644 --- a/DesktopVRIK/VRIKUtils.cs +++ b/DesktopVRIK/VRIKUtils.cs @@ -5,23 +5,16 @@ namespace NAK.DesktopVRIK; public static class VRIKUtils { - public static void ConfigureVRIKReferences(VRIK vrik, bool useVRIKToes, bool findUnmappedToes, out bool foundUnmappedToes) + public static void ConfigureVRIKReferences(VRIK vrik, bool useVRIKToes) { - foundUnmappedToes = false; - //might not work over netik - FixChestAndSpineReferences(vrik); + //FixChestAndSpineReferences(vrik); if (!useVRIKToes) { vrik.references.leftToes = null; vrik.references.rightToes = null; } - else if (findUnmappedToes) - { - //doesnt work with netik, but its toes... - FindAndSetUnmappedToes(vrik, out foundUnmappedToes); - } //bullshit fix to not cause death FixFingerBonesError(vrik); @@ -41,41 +34,6 @@ public static class VRIKUtils } } - private static void FindAndSetUnmappedToes(VRIK vrik, out bool foundUnmappedToes) - { - foundUnmappedToes = false; - - Transform leftToes = vrik.references.leftToes; - Transform rightToes = vrik.references.rightToes; - - if (leftToes == null && rightToes == null) - { - leftToes = FindUnmappedToe(vrik.references.leftFoot); - rightToes = FindUnmappedToe(vrik.references.rightFoot); - - if (leftToes != null && rightToes != null) - { - vrik.references.leftToes = leftToes; - vrik.references.rightToes = rightToes; - foundUnmappedToes = true; - } - } - } - - private static Transform FindUnmappedToe(Transform foot) - { - foreach (Transform bone in foot) - { - if (bone.name.ToLowerInvariant().Contains("toe") || - bone.name.ToLowerInvariant().EndsWith("_end")) - { - return bone; - } - } - - return null; - } - private static void FixFingerBonesError(VRIK vrik) { FixFingerBones(vrik, vrik.references.leftHand, vrik.solver.leftArm);