tweaks to not make PAM and BID wonky

also fuck vrik toes, those literally stink
This commit is contained in:
NotAKidoS 2023-02-02 20:38:22 -06:00
parent b4fb9e62e6
commit d3d058607f
7 changed files with 79 additions and 84 deletions

View file

@ -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;
}
}

View file

@ -17,12 +17,11 @@ public class DesktopVRIK : MonoBehaviour
Setting_Enabled, Setting_Enabled,
Setting_EnforceViewPosition, Setting_EnforceViewPosition,
Setting_EmoteVRIK, Setting_EmoteVRIK,
Setting_EmoteLookAtIK, Setting_EmoteLookAtIK;
Setting_Internal_PlantFeet = true;
public static float public static float
Setting_BodyLeanWeight = 0.3f, Setting_BodyLeanWeight = 0.5f,
Setting_BodyAngleLimit = 45f; Setting_BodyAngleLimit = 0f;
public Transform viewpoint; public Transform viewpoint;
public Vector3 eyeOffset; public Vector3 eyeOffset;
@ -46,14 +45,15 @@ public class DesktopVRIK : MonoBehaviour
public void AlternativeOnPreSolverUpdate() 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(); DesktopVRIK_Helper.Instance?.OnUpdateVRIK();
//Reset avatar offset (VRIK will literally make you walk away from root otherwise) //Reset avatar offset (VRIK will literally make you walk away from root otherwise)
IKSystem.vrik.transform.localPosition = Vector3.zero; IKSystem.vrik.transform.localPosition = Vector3.zero;
IKSystem.vrik.transform.localRotation = Quaternion.identity; IKSystem.vrik.transform.localRotation = Quaternion.identity;
IKSystem.vrik.solver.plantFeet = Setting_Internal_PlantFeet; IKSystem.vrik.solver.plantFeet = true;
} }
public Animator animator; public Animator animator;
@ -79,17 +79,27 @@ public class DesktopVRIK : MonoBehaviour
animator.Update(0f); animator.Update(0f);
} }
//Generic VRIK calibration shit
VRIK vrik = avatar.gameObject.AddComponent<VRIK>(); VRIK vrik = avatar.gameObject.AddComponent<VRIK>();
vrik.AutoDetectReferences(); vrik.AutoDetectReferences();
//fuck toes
vrik.references.leftToes = null;
vrik.references.rightToes = null;
vrik.fixTransforms = true; vrik.fixTransforms = true;
vrik.solver.plantFeet = false; vrik.solver.plantFeet = false;
vrik.solver.locomotion.weight = 0f;
vrik.solver.locomotion.angleThreshold = 30f; vrik.solver.locomotion.angleThreshold = 30f;
vrik.solver.locomotion.maxLegStretch = 0.75f; vrik.solver.locomotion.maxLegStretch = 0.75f;
//nuke weights vrik.solver.spine.minHeadHeight = -100f;
vrik.solver.spine.minHeadHeight = 0f;
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.spine.pelvisPositionWeight = 0f;
vrik.solver.leftArm.positionWeight = 0f; vrik.solver.leftArm.positionWeight = 0f;
vrik.solver.leftArm.rotationWeight = 0f; vrik.solver.leftArm.rotationWeight = 0f;
@ -101,27 +111,11 @@ public class DesktopVRIK : MonoBehaviour
vrik.solver.rightLeg.rotationWeight = 0f; vrik.solver.rightLeg.rotationWeight = 0f;
vrik.solver.IKPositionWeight = 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.TrackingLeftArmEnabled = false;
BodySystem.TrackingRightArmEnabled = false; BodySystem.TrackingRightArmEnabled = false;
BodySystem.TrackingLeftLegEnabled = false; BodySystem.TrackingLeftLegEnabled = false;
BodySystem.TrackingRightLegEnabled = false; BodySystem.TrackingRightLegEnabled = false;
BodySystem.TrackingPositionWeight = 0f; BodySystem.TrackingPositionWeight = 0f;
IKSystem.Instance.headAnchorRotationOffset = Vector3.zero;
IKSystem.Instance.headAnchorPositionOffset = Vector3.zero;
//Custom funky AF head ik shit //Custom funky AF head ik shit
foreach (Transform transform in DesktopVRIK_Helper.Instance.ik_HeadFollower) foreach (Transform transform in DesktopVRIK_Helper.Instance.ik_HeadFollower)

View file

@ -51,7 +51,7 @@ internal class DesktopVRIK_Helper : MonoBehaviour
globalWeight *= IKSystem.vrik.solver.locomotion.weight; globalWeight *= IKSystem.vrik.solver.locomotion.weight;
//the most important thing ever //the most important thing ever
IKSystem.vrik.solver.spine.rotationWeight = globalWeight; //IKSystem.vrik.solver.spine.rotationWeight = globalWeight;
HeadIK_FollowPosition(); HeadIK_FollowPosition();

View file

@ -139,7 +139,7 @@ class IKSystemPatches
____poseHandler.SetHumanPose(ref ___humanPose); ____poseHandler.SetHumanPose(ref ___humanPose);
____vrik = DesktopVRIK.Instance.AlternativeCalibration(avatar); ____vrik = DesktopVRIK.Instance.AlternativeCalibration(avatar);
IKSystem.Instance.ApplyAvatarScaleToIk(avatar.viewPosition.y); IKSystem.Instance.ApplyAvatarScaleToIk(avatar.viewPosition.y);
} }
} }
} }

View file

@ -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<bool> entry)
{
category.AddToggle(entry.DisplayName, entry.Description, entry.Value).OnValueUpdated += b => entry.Value = b;
}
private static void AddMelonSlider(ref Page page, MelonLoader.MelonPreferences_Entry<float> entry, float min, float max)
{
page.AddSlider(entry.DisplayName, entry.Description, entry.Value, min, max).OnValueUpdated += f => entry.Value = f;
}
}

View file

@ -11,9 +11,8 @@ public class DesktopVRIKMod : MelonMod
internal static MelonPreferences_Entry<bool> m_entryEnabled, internal static MelonPreferences_Entry<bool> m_entryEnabled,
m_entryEnforceViewPosition, m_entryEnforceViewPosition,
m_entryEmoteVRIK, m_entryEmoteVRIK,
m_entryEmoteLookAtIK, m_entryEmoteLookAtIK;
m_entryAllowRootSlipping; internal static MelonPreferences_Entry<float>
internal static MelonPreferences_Entry<float>
m_entryBodyLeanWeight, m_entryBodyLeanWeight,
m_entryBodyAngleLimit; m_entryBodyAngleLimit;
public override void OnInitializeMelon() public override void OnInitializeMelon()
@ -24,8 +23,8 @@ public class DesktopVRIKMod : MelonMod
m_entryEmoteVRIK = m_categoryDesktopVRIK.CreateEntry<bool>("Disable Emote VRIK", true, description: "Disable VRIK while emoting. Only disable if you are ok with looking dumb."); m_entryEmoteVRIK = m_categoryDesktopVRIK.CreateEntry<bool>("Disable Emote VRIK", true, description: "Disable VRIK while emoting. Only disable if you are ok with looking dumb.");
m_entryEmoteLookAtIK = m_categoryDesktopVRIK.CreateEntry<bool>("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_entryEmoteLookAtIK = m_categoryDesktopVRIK.CreateEntry<bool>("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<float>("Body Lean Weight", 0.3f, description: "Emulates old VRChat-like body leaning when looking up/down. Set to 0 to disable."); m_entryBodyLeanWeight = m_categoryDesktopVRIK.CreateEntry<float>("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<float>("Body Angle Limit", 45f, description: "Emulates VRChat-like body and head offset when rotating left/right. Set to 0 to disable."); m_entryBodyAngleLimit = m_categoryDesktopVRIK.CreateEntry<float>("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) foreach (var setting in m_categoryDesktopVRIK.Entries)
{ {
@ -36,7 +35,7 @@ public class DesktopVRIKMod : MelonMod
if (MelonMod.RegisteredMelons.Any(it => it.Info.Name == "BTKUILib")) if (MelonMod.RegisteredMelons.Any(it => it.Info.Name == "BTKUILib"))
{ {
MelonLogger.Msg("Initializing BTKUILib support."); MelonLogger.Msg("Initializing BTKUILib support.");
BTKUI_Integration.BTKUI_Integration.Init(); BTKUIAddon.Init();
} }
//Apply patches (i stole) //Apply patches (i stole)

View file

@ -1,7 +1,7 @@
{ {
"_id": 117, "_id": 117,
"name": "DesktopVRIK", "name": "DesktopVRIK",
"modversion": "2.0.2", "modversion": "2.0.3",
"gameversion": "2022r170", "gameversion": "2022r170",
"loaderversion": "0.5.7", "loaderversion": "0.5.7",
"modtype": "Mod", "modtype": "Mod",
@ -14,10 +14,10 @@
"feet" "feet"
], ],
"requirements": [ "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/", "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" "embedcolor": "9b59b6"
} }