mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[IKFixes] Fix HalfbodyIK feet with IKPose.
This commit is contained in:
parent
a8bf0ef7f9
commit
b17ce245e5
4 changed files with 131 additions and 6 deletions
|
@ -264,13 +264,135 @@ internal static class IKSystemPatches
|
|||
__instance._referenceRootRotation = hips.rotation;
|
||||
__instance._poseHandler.GetHumanPose(ref __instance.humanPose);
|
||||
__instance._poseHandler.SetHumanPose(ref __instance.humanPose);
|
||||
hips.position = __instance._referenceRootPosition;
|
||||
hips.position = __instance._referenceRootPosition;
|
||||
hips.rotation = __instance._referenceRootRotation;
|
||||
};
|
||||
|
||||
IKSystem._vrik.onPostSolverUpdate.AddListener(onPostSolverUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(IKSystem), nameof(IKSystem.InitializeHalfBodyIK))]
|
||||
static void Postfix_IKSystem_InitializeHalfBodyIK(ref IKSystem __instance)
|
||||
{
|
||||
if (!IKFixes.EntryUseIKPose.Value) return;
|
||||
|
||||
__instance._poseHandler.GetHumanPose(ref __instance.humanPose);
|
||||
|
||||
for (int i = 0; i < IKPoseMuscles.Length; i++)
|
||||
{
|
||||
__instance.ApplyMuscleValue((MuscleIndex)i, IKPoseMuscles[i], ref __instance.humanPose.muscles);
|
||||
}
|
||||
__instance.humanPose.bodyPosition = Vector3.up;
|
||||
__instance.humanPose.bodyRotation = Quaternion.identity;
|
||||
__instance._poseHandler.SetHumanPose(ref __instance.humanPose);
|
||||
|
||||
// recentering avatar so it doesnt need to step from random place on switch
|
||||
IKSystem.vrik.transform.localPosition = Vector3.zero;
|
||||
IKSystem.vrik.transform.localRotation = Quaternion.identity;
|
||||
// janky fix, initializing early with correct pose
|
||||
IKSystem.vrik.solver.Initiate(IKSystem.vrik.transform);
|
||||
}
|
||||
|
||||
static readonly float[] IKPoseMuscles = new float[]
|
||||
{
|
||||
0.00133321f,
|
||||
8.195831E-06f,
|
||||
8.537738E-07f,
|
||||
-0.002669832f,
|
||||
-7.651234E-06f,
|
||||
-0.001659694f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0.04213953f,
|
||||
0.0003007996f,
|
||||
-0.008032114f,
|
||||
-0.03059979f,
|
||||
-0.0003182998f,
|
||||
0.009640567f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0f,
|
||||
0.5768794f,
|
||||
0.01061097f,
|
||||
-0.1127839f,
|
||||
0.9705755f,
|
||||
0.07972051f,
|
||||
-0.0268422f,
|
||||
0.007237188f,
|
||||
0f,
|
||||
0.5768792f,
|
||||
0.01056608f,
|
||||
-0.1127519f,
|
||||
0.9705756f,
|
||||
0.07971933f,
|
||||
-0.02682396f,
|
||||
0.007229362f,
|
||||
0f,
|
||||
-5.651802E-06f,
|
||||
-3.034899E-07f,
|
||||
0.4100508f,
|
||||
0.3610304f,
|
||||
-0.0838329f,
|
||||
0.9262537f,
|
||||
0.1353517f,
|
||||
-0.03578902f,
|
||||
0.06005657f,
|
||||
-4.95989E-06f,
|
||||
-1.43007E-06f,
|
||||
0.4096187f,
|
||||
0.363263f,
|
||||
-0.08205152f,
|
||||
0.9250782f,
|
||||
0.1345718f,
|
||||
-0.03572125f,
|
||||
0.06055461f,
|
||||
-1.079177f,
|
||||
0.2095419f,
|
||||
0.6140652f,
|
||||
0.6365265f,
|
||||
0.6683931f,
|
||||
-0.4764312f,
|
||||
0.8099416f,
|
||||
0.8099371f,
|
||||
0.6658203f,
|
||||
-0.7327053f,
|
||||
0.8113618f,
|
||||
0.8114051f,
|
||||
0.6643661f,
|
||||
-0.40341f,
|
||||
0.8111364f,
|
||||
0.8111367f,
|
||||
0.6170399f,
|
||||
-0.2524227f,
|
||||
0.8138723f,
|
||||
0.8110135f,
|
||||
-1.079171f,
|
||||
0.2095456f,
|
||||
0.6140658f,
|
||||
0.6365255f,
|
||||
0.6683878f,
|
||||
-0.4764301f,
|
||||
0.8099402f,
|
||||
0.8099376f,
|
||||
0.6658241f,
|
||||
-0.7327023f,
|
||||
0.8113653f,
|
||||
0.8113793f,
|
||||
0.664364f,
|
||||
-0.4034042f,
|
||||
0.811136f,
|
||||
0.8111364f,
|
||||
0.6170469f,
|
||||
-0.2524345f,
|
||||
0.8138595f,
|
||||
0.8110138f
|
||||
};
|
||||
}
|
||||
|
||||
internal static class VRIKPatches
|
||||
|
|
|
@ -25,6 +25,9 @@ public class IKFixes : MelonMod
|
|||
public static readonly MelonPreferences_Entry<bool> EntryAssignRemainingTrackers =
|
||||
Category.CreateEntry("Assign Remaining Trackers", true, description: "Should the game calibrate any additional trackers as secondary trackers for already-tracked points?");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryUseIKPose =
|
||||
Category.CreateEntry("Use IK Pose", true, description: "Should an IKPose be used after VRIK initialization? This can fix some issues with feet targeting.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryNetIKPass =
|
||||
Category.CreateEntry("Network IK Pass", true, description: "Should NetIK pass be applied? This fixes a bunch of small rotation errors after VRIK is run.");
|
||||
|
||||
|
|
|
@ -25,6 +25,6 @@ using System.Reflection;
|
|||
namespace NAK.IKFixes.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.3";
|
||||
public const string Version = "1.0.4";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"_id": 142,
|
||||
"name": "IKFixes",
|
||||
"modversion": "1.0.3",
|
||||
"modversion": "1.0.4",
|
||||
"gameversion": "2022r170",
|
||||
"loaderversion": "0.5.7",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "A few small fixes to IK. Major ones are listed below:\n\n**FBT** - Fixes knee tracking & running animations.\n\n**Halfbody** - Fixes footsteps while on a MovementParent & uses root angle offset to prevent feet from only pointing in head direction.",
|
||||
"description": "A few small fixes and configuration options to IK. Major ones are listed below:\n\n**FBT** - Fixes knee tracking, running animation direction, and animation bleeding into IK while calibrating/running. (no more chest tracker wiggle)\n\n**Halfbody** - Fixes footsteps while on a MovementParent, uses root angle offset to prevent feet from only pointing in head direction, and uses an IKPose to fix feet pointing upward.",
|
||||
"searchtags": [
|
||||
"knee",
|
||||
"ik",
|
||||
|
@ -16,8 +16,8 @@
|
|||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r3/IKFixes.dll",
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r5/IKFixes.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/IKFixes/",
|
||||
"changelog": "- Fixed feet targeting previous movement parent position for a frame.",
|
||||
"changelog": "- Added fix for animations affecting root to bleed into IK. This fixes chest tracker flailing around when running.\n- Added fix to use an IKPose after HalfbodyIK Initialization. This fixes feet pointing upward in halfbody.\n- Fixed patch to leg solver that prevented lower leg rotation while using knee trackers.\n- Adjusted elbow target offsets for a balance between accuracy and stability. Makes StandableFBE-tracked elbows feel much better to use.\n- Added option to disable AssignRemainingTrackers feature.",
|
||||
"embedcolor": "f46e49"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue