diff --git a/DesktopVRIK/DesktopVRIK.cs b/DesktopVRIK/DesktopVRIK.cs index 70d0b6a..f329628 100644 --- a/DesktopVRIK/DesktopVRIK.cs +++ b/DesktopVRIK/DesktopVRIK.cs @@ -52,96 +52,6 @@ public class DesktopVRIK : MonoBehaviour PlayerSetup.Instance.desktopCamera.transform.localPosition = initialCamPos; } - public void OnPreSolverUpdate() - { - //this order matters, rotation offset will be choppy if avatar is not cenetered first - //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; - //VRChat hip movement emulation - if (Setting_EmulateVRChatHipMovementWeight != 0) - { - float angle = PlayerSetup.Instance.desktopCamera.transform.localEulerAngles.x; - if (angle > 180) angle -= 360; - float leanAmount = angle * (1 - MovementSystem.Instance.movementVector.magnitude) * Setting_EmulateVRChatHipMovementWeight; - Quaternion rotation = Quaternion.AngleAxis(leanAmount, IKSystem.Instance.avatar.transform.right); - IKSystem.vrik.solver.AddRotationOffset(IKSolverVR.RotationOffset.Head, rotation); - } - IKSystem.vrik.solver.plantFeet = true; - } - - public void CalibrateDesktopVRIK(CVRAvatar avatar) - { - //ikpose layer (specified by avatar author) - int? ikposeLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("IKPose"); - int? locoLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("Locomotion/Emotes"); - - if (ikposeLayerIndex != -1) - { - PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 1f); - if (locoLayerIndex != -1) - { - PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 0f); - } - IKSystem.Instance.animator.Update(0f); - } - - - //Stuff to make bad armatures work (Fuck you Default Robot Kyle) - avatar.transform.localPosition = Vector3.zero; - Quaternion originalRotation = avatar.transform.rotation; - avatar.transform.rotation = Quaternion.identity; - - //Generic VRIK calibration shit - - IKSystem.vrik.fixTransforms = false; - IKSystem.vrik.solver.plantFeet = false; - IKSystem.vrik.solver.locomotion.weight = 1f; - IKSystem.vrik.solver.locomotion.angleThreshold = 30f; - IKSystem.vrik.solver.locomotion.maxLegStretch = 0.75f; - //nuke weights - IKSystem.vrik.AutoDetectReferences(); - IKSystem.vrik.solver.spine.headClampWeight = 0f; - IKSystem.vrik.solver.spine.minHeadHeight = 0f; - IKSystem.vrik.solver.leftArm.positionWeight = 0f; - IKSystem.vrik.solver.leftArm.rotationWeight = 0f; - IKSystem.vrik.solver.rightArm.positionWeight = 0f; - IKSystem.vrik.solver.rightArm.rotationWeight = 0f; - IKSystem.vrik.solver.leftLeg.positionWeight = 0f; - IKSystem.vrik.solver.leftLeg.rotationWeight = 0f; - IKSystem.vrik.solver.rightLeg.positionWeight = 0f; - IKSystem.vrik.solver.rightLeg.rotationWeight = 0f; - - //ChilloutVR specific stuff - - - - IKSystem.vrik.enabled = false; - - //Calibrate HeadIKOffset *(this is fucked on some avatars, (Fuck you Default Robot Kyle) but setting headAnchorRotationOffset to head rotation fixes (Fuck you Default Robot Kyle))* - - IKSystem.vrik.enabled = true; - IKSystem.vrik.solver.IKPositionWeight = 1f; - IKSystem.vrik.solver.spine.maintainPelvisPosition = 0f; - if (IKSystem.vrik != null) - { - IKSystem.vrik.onPreSolverUpdate.AddListener(new UnityAction(this.OnPreSolverUpdate)); - } - - if (ikposeLayerIndex != -1) - { - PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 0f); - if (locoLayerIndex != -1) - { - PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 1f); - } - } - - avatar.transform.rotation = originalRotation; - IKSystem.Instance.ResetIK(); - IKSystem.Instance.animator.enabled = true; - } - public void AlternativeOnPreSolverUpdate() { //this order matters, rotation offset will be choppy if avatar is not cenetered first @@ -185,6 +95,20 @@ public class DesktopVRIK : MonoBehaviour //originalRotation = avatar.transform.rotation; //avatar.transform.rotation = Quaternion.identity; + //ikpose layer (specified by avatar author) + int? ikposeLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("IKPose"); + int? locoLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("Locomotion/Emotes"); + + if (ikposeLayerIndex != -1) + { + PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 1f); + if (locoLayerIndex != -1) + { + PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 0f); + } + IKSystem.Instance.animator.Update(0f); + } + //Generic VRIK calibration shit VRIK vrik = avatar.gameObject.AddComponent(); vrik.AutoDetectReferences(); @@ -197,7 +121,7 @@ public class DesktopVRIK : MonoBehaviour //nuke weights vrik.solver.spine.headClampWeight = 0f; vrik.solver.spine.minHeadHeight = 0f; - vrik.solver.spine.pelvisPositionWeight = 0f; + //vrik.solver.spine.pelvisPositionWeight = 0f; vrik.solver.leftArm.positionWeight = 0f; vrik.solver.leftArm.rotationWeight = 0f; vrik.solver.rightArm.positionWeight = 0f; @@ -233,6 +157,15 @@ public class DesktopVRIK : MonoBehaviour vrik.solver.SetToReferences(vrik.references); vrik.solver.Initiate(vrik.transform); + if (ikposeLayerIndex != -1) + { + PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 0f); + if (locoLayerIndex != -1) + { + PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 1f); + } + } + if (Setting_TestIKPoseController) { animator.enabled = false; diff --git a/DesktopVRIK/Main.cs b/DesktopVRIK/Main.cs index dcc7ebd..d77a5ae 100644 --- a/DesktopVRIK/Main.cs +++ b/DesktopVRIK/Main.cs @@ -11,7 +11,8 @@ public class DesktopVRIKMod : MelonMod internal static MelonPreferences_Entry m_entryEnabled, m_entryEnforceViewPosition, m_entryEmoteVRIK, - m_entryEmoteLookAtIK; + m_entryEmoteLookAtIK, + m_entryAllowRootSlipping; internal static MelonPreferences_Entry m_entryEmulateVRChatHipMovementWeight; public override void OnInitializeMelon() { @@ -21,6 +22,7 @@ public class DesktopVRIKMod : MelonMod m_entryEnforceViewPosition = m_categoryDesktopVRIK.CreateEntry("Enforce View Position", false, description: "Corrects view position to use VRIK offsets."); 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_entryAllowRootSlipping = m_categoryDesktopVRIK.CreateEntry("Allow Root Slipping", false, description: "Allows avatar root to slip out from under itself, to emulate more wacky VRChat behavior."); foreach (var setting in m_categoryDesktopVRIK.Entries) { @@ -59,6 +61,7 @@ public class DesktopVRIKMod : MelonMod DesktopVRIK.Setting_EmulateVRChatHipMovementWeight = Mathf.Clamp01(m_entryEmulateVRChatHipMovementWeight.Value); DesktopVRIK.Setting_EmoteVRIK = m_entryEmoteVRIK.Value; DesktopVRIK.Setting_EmoteLookAtIK = m_entryEmoteLookAtIK.Value; + DesktopVRIK.Setting_AllowRootSlipping = m_entryAllowRootSlipping.Value; DesktopVRIK.Instance.ChangeViewpointHandling(m_entryEnforceViewPosition.Value); } diff --git a/DesktopVRIK/Properties/AssemblyInfo.cs b/DesktopVRIK/Properties/AssemblyInfo.cs index fecfa4f..c076769 100644 --- a/DesktopVRIK/Properties/AssemblyInfo.cs +++ b/DesktopVRIK/Properties/AssemblyInfo.cs @@ -26,6 +26,6 @@ using System.Reflection; namespace DesktopVRIK.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.5"; + public const string Version = "2.0.0"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/DesktopVRIK/format.json b/DesktopVRIK/format.json index 0b534f6..ba61c32 100644 --- a/DesktopVRIK/format.json +++ b/DesktopVRIK/format.json @@ -1,7 +1,7 @@ { "_id": 117, "name": "DesktopVRIK", - "modversion": "1.0.4", + "modversion": "2.0.0", "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v1.0.3/DesktopVRIK.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v2.0.0/DesktopVRIK.dll", "sourcelink": "https://github.com/NotAKidOnSteam/DesktopVRIK/", - "changelog": "- Simplified VRIK calibration to avoid low heel issue.\n- Removed rushed compatibility mode.\n- Added checks for valid Humanoid rigs.\n- Added PlantFeet & EnforceViewPosition Settings.\n- Added Weight option for the VRChat-like hip movement.", + "changelog": "- Simplified VRIK calibration to avoid low heel issue.\n- Removed rushed compatibility mode.\n- Added checks for valid Humanoid rigs.\n- Added PlantFeet & EnforceViewPosition Settings.\n- Added Weight option for the VRChat-like hip movement.\n- Simplified config, added BTKUILib support.\n- Reworked calibration to support almost every avatar.\n- Added custom avatar-defined IKPose support.", "embedcolor": "9b59b6" } \ No newline at end of file