mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
attempt to fix compatibility with more avatars
(Fuck you Default Robot Kyle)(Fuck you Default Robot Kyle)(Fuck you Default Robot Kyle)(Fuck you Default Robot Kyle)(Fuck you Default Robot Kyle)(Fuck you Default Robot Kyle)(Fuck you Default Robot Kyle)
This commit is contained in:
parent
04de34d5d3
commit
fb5c3c00b5
4 changed files with 152 additions and 12 deletions
|
@ -59,6 +59,12 @@ public class DesktopVRIK : MonoBehaviour
|
|||
|
||||
public void CalibrateDesktopVRIK(CVRAvatar avatar)
|
||||
{
|
||||
//Stuff to make bad armatures work (Fuck you Default Robot Kyle)
|
||||
IKSystem.Instance.animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
|
||||
avatar.transform.localPosition = Vector3.zero;
|
||||
Quaternion originalRotation = avatar.transform.rotation;
|
||||
avatar.transform.rotation = Quaternion.identity;
|
||||
|
||||
//Generic VRIK calibration shit
|
||||
|
||||
IKSystem.vrik.fixTransforms = false;
|
||||
|
@ -89,7 +95,7 @@ public class DesktopVRIK : MonoBehaviour
|
|||
//centerEyeAnchor now is head bone
|
||||
Transform headAnchor = FindIKTarget(headTransform);
|
||||
IKSystem.Instance.headAnchorPositionOffset = Vector3.zero;
|
||||
IKSystem.Instance.headAnchorRotationOffset = Vector3.zero;
|
||||
IKSystem.Instance.headAnchorRotationOffset = headAnchor.rotation.eulerAngles; //set to head bone world rotation (Fuck you Default Robot Kyle)
|
||||
IKSystem.Instance.ApplyAvatarScaleToIk(avatar.viewPosition.y);
|
||||
BodySystem.TrackingLeftArmEnabled = false;
|
||||
BodySystem.TrackingRightArmEnabled = false;
|
||||
|
@ -97,8 +103,10 @@ public class DesktopVRIK : MonoBehaviour
|
|||
BodySystem.TrackingRightLegEnabled = false;
|
||||
IKSystem.vrik.solver.IKPositionWeight = 0f;
|
||||
IKSystem.vrik.enabled = false;
|
||||
//Calibrate HeadIKOffset
|
||||
|
||||
//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))*
|
||||
VRIKCalibrator.CalibrateHead(IKSystem.vrik, headAnchor, IKSystem.Instance.headAnchorPositionOffset, IKSystem.Instance.headAnchorRotationOffset);
|
||||
|
||||
IKSystem.vrik.enabled = true;
|
||||
IKSystem.vrik.solver.IKPositionWeight = 1f;
|
||||
IKSystem.vrik.solver.spine.maintainPelvisPosition = 0f;
|
||||
|
@ -106,6 +114,10 @@ public class DesktopVRIK : MonoBehaviour
|
|||
{
|
||||
IKSystem.vrik.onPreSolverUpdate.AddListener(new UnityAction(this.OnPreSolverUpdate));
|
||||
}
|
||||
|
||||
//(Fuck you Default Robot Kyle).. oh wait nvm, not related
|
||||
avatar.transform.rotation = originalRotation;
|
||||
IKSystem.Instance.ResetIK();
|
||||
}
|
||||
|
||||
//This is built because original build placed IK Targets on all joints.
|
||||
|
|
|
@ -9,6 +9,30 @@ using HarmonyLib;
|
|||
using RootMotion.FinalIK;
|
||||
using UnityEngine;
|
||||
|
||||
/**
|
||||
|
||||
The process of calibrating VRIK is fucking painful.
|
||||
|
||||
Immediatly doing GetHumanPose() and then SetHumanPose() fixed heels in ground for all avatars.
|
||||
|
||||
Setting the avatars rotation to identity, head rotation offset to head bone world rotation, and then calibrating head IK target (kinda) fixed only robot kyle.
|
||||
|
||||
Enforcing a TPose only fixed my ferret avatars right shoulder.
|
||||
|
||||
Mix and matching these, and changing order, fucks with random specific avatars with fucky armatures.
|
||||
MOST AVATARS DONT EVEN CHANGE, ITS JUST THESE FEW SPECIFIC ONES
|
||||
I NEED to look into an IKPose controller...
|
||||
|
||||
Avatars of Note:
|
||||
TurtleNeck Ferret- broken/inverted right shoulder
|
||||
Space Robot Kyle- head ik target is rotated -90 90 0, so body/neck is fucked (Fuck you Default Robot Kyle)
|
||||
Exteratta- the knees bend backwards like a fucking chicken... what the fuck im enforcing a tpose nowww
|
||||
|
||||
Most other avatars play just fine. Never changes even when adding Tpose, rotating the avatar, headikrotationoffset, ect...
|
||||
WHY (Fuck you Default Robot Kyle)
|
||||
|
||||
**/
|
||||
|
||||
namespace DesktopVRIK;
|
||||
|
||||
[HarmonyPatch]
|
||||
|
@ -37,20 +61,24 @@ internal class HarmonyPatches
|
|||
{
|
||||
if (IKSystem.Instance.animator != null && IKSystem.Instance.animator.avatar != null && IKSystem.Instance.animator.avatar.isHuman)
|
||||
{
|
||||
//need IKSystem to see VRIK component for setup
|
||||
if (____vrik == null)
|
||||
{
|
||||
____vrik = avatar.gameObject.AddComponent<VRIK>();
|
||||
}
|
||||
|
||||
//why the fuck does this fix bad armatures and heels in ground ???
|
||||
//why the fuck does this fix bad armatures and heels in ground ??? (this one is suprisingly not because of Default Robot Kyle) ... (Fuck you Default Robot Kyle)
|
||||
if (____poseHandler == null)
|
||||
{
|
||||
____poseHandler = new HumanPoseHandler(IKSystem.Instance.animator.avatar, IKSystem.Instance.animator.transform);
|
||||
}
|
||||
____poseHandler.GetHumanPose(ref ___humanPose);
|
||||
for (int i = 0; i < TPoseMuscles.Length; i++)
|
||||
{
|
||||
IKSystem.Instance.ApplyMuscleValue((MuscleIndex)i, TPoseMuscles[i], ref ___humanPose.muscles);
|
||||
}
|
||||
____poseHandler.SetHumanPose(ref ___humanPose);
|
||||
|
||||
//need IKSystem to see VRIK component for setup
|
||||
if (____vrik == null)
|
||||
{
|
||||
____vrik = avatar.gameObject.AddComponent<VRIK>();
|
||||
}
|
||||
|
||||
//now I calibrate DesktopVRIK
|
||||
DesktopVRIK.Instance.CalibrateDesktopVRIK(avatar);
|
||||
}
|
||||
|
@ -111,4 +139,104 @@ internal class HarmonyPatches
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly float[] TPoseMuscles = new float[]
|
||||
{
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0.6001086f,
|
||||
8.6213E-05f,
|
||||
-0.0003308152f,
|
||||
0.9999163f,
|
||||
-9.559652E-06f,
|
||||
3.41413E-08f,
|
||||
-3.415095E-06f,
|
||||
-1.024528E-07f,
|
||||
0.6001086f,
|
||||
8.602679E-05f,
|
||||
-0.0003311098f,
|
||||
0.9999163f,
|
||||
-9.510122E-06f,
|
||||
1.707468E-07f,
|
||||
-2.732077E-06f,
|
||||
2.035554E-15f,
|
||||
-2.748694E-07f,
|
||||
2.619475E-07f,
|
||||
0.401967f,
|
||||
0.3005583f,
|
||||
0.04102772f,
|
||||
0.9998822f,
|
||||
-0.04634236f,
|
||||
0.002522987f,
|
||||
0.0003842837f,
|
||||
-2.369134E-07f,
|
||||
-2.232262E-07f,
|
||||
0.4019674f,
|
||||
0.3005582f,
|
||||
0.04103433f,
|
||||
0.9998825f,
|
||||
-0.04634996f,
|
||||
0.00252335f,
|
||||
0.000383302f,
|
||||
-1.52127f,
|
||||
0.2634507f,
|
||||
0.4322457f,
|
||||
0.6443988f,
|
||||
0.6669409f,
|
||||
-0.4663372f,
|
||||
0.8116828f,
|
||||
0.8116829f,
|
||||
0.6678119f,
|
||||
-0.6186608f,
|
||||
0.8116842f,
|
||||
0.8116842f,
|
||||
0.6677991f,
|
||||
-0.619225f,
|
||||
0.8116842f,
|
||||
0.811684f,
|
||||
0.6670032f,
|
||||
-0.465875f,
|
||||
0.811684f,
|
||||
0.8116836f,
|
||||
-1.520098f,
|
||||
0.2613016f,
|
||||
0.432256f,
|
||||
0.6444503f,
|
||||
0.6668426f,
|
||||
-0.4670413f,
|
||||
0.8116828f,
|
||||
0.8116828f,
|
||||
0.6677986f,
|
||||
-0.6192409f,
|
||||
0.8116841f,
|
||||
0.811684f,
|
||||
0.6677839f,
|
||||
-0.6198869f,
|
||||
0.8116839f,
|
||||
0.8116838f,
|
||||
0.6668782f,
|
||||
-0.4667901f,
|
||||
0.8116842f,
|
||||
0.811684f
|
||||
};
|
||||
|
||||
}
|
|
@ -20,7 +20,7 @@ public class DesktopVRIKMod : MelonMod
|
|||
m_categoryDesktopVRIK = MelonPreferences.CreateCategory(SettingsCategory);
|
||||
m_entryEnabled = m_categoryDesktopVRIK.CreateEntry<bool>("Enabled", true, description: "Attempt to give Desktop VRIK on avatar load.");
|
||||
m_entryEmulateHipMovement = m_categoryDesktopVRIK.CreateEntry<bool>("Emulate Hip Movement", true, description: "Emulates VRChat-like hip movement when moving head up/down on desktop.");
|
||||
m_entryEmulateVRChatHipMovementWeight = m_categoryDesktopVRIK.CreateEntry<float>("Hip Movement Weight", 1f, description: "The weight modifier for the hip movement.");
|
||||
m_entryEmulateVRChatHipMovementWeight = m_categoryDesktopVRIK.CreateEntry<float>("Hip Movement Weight", 0.5f, description: "The weight modifier for the hip movement.");
|
||||
m_entryEnforceViewPosition = m_categoryDesktopVRIK.CreateEntry<bool>("Enforce View Position", false, description: "Corrects view position to use VRIK offsets.");
|
||||
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.");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_id": 117,
|
||||
"name": "DesktopVRIK",
|
||||
"modversion": "1.0.3",
|
||||
"modversion": "1.0.4",
|
||||
"gameversion": "2022r170",
|
||||
"loaderversion": "0.5.7",
|
||||
"modtype": "Mod",
|
||||
|
@ -18,6 +18,6 @@
|
|||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v1.0.3/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.",
|
||||
"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.",
|
||||
"embedcolor": "9b59b6"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue