mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 06:49:22 +00:00
[IKFixes] NetIKPass test
This commit is contained in:
parent
b37ebb4683
commit
a8bf0ef7f9
2 changed files with 8 additions and 36 deletions
|
@ -55,29 +55,12 @@ internal static class BodySystemPatches
|
||||||
|
|
||||||
// Apply additional offset based on the assigned role
|
// Apply additional offset based on the assigned role
|
||||||
Vector3 additionalOffset = IKSystem.vrik.references.root.forward * offsetDistance;
|
Vector3 additionalOffset = IKSystem.vrik.references.root.forward * offsetDistance;
|
||||||
|
|
||||||
if (IKFixes.EntryAltElbowDirection.Value)
|
|
||||||
{
|
|
||||||
switch (trackingPoint.assignedRole)
|
|
||||||
{
|
|
||||||
case TrackingPoint.TrackingRole.LeftElbow:
|
|
||||||
additionalOffset += IKSystem.vrik.references.root.up * -0.15f;
|
|
||||||
break;
|
|
||||||
case TrackingPoint.TrackingRole.RightElbow:
|
|
||||||
additionalOffset += IKSystem.vrik.references.root.up * -0.15f;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trackingPoint.offsetTransform.position += additionalOffset;
|
trackingPoint.offsetTransform.position += additionalOffset;
|
||||||
|
|
||||||
// Game originally sets them to about half a meter out, which fucks with slime tracker users and
|
// Game originally sets them to about half a meter out, which fucks with slime tracker users and
|
||||||
// makes the bendGoals less responsive/less accurate.
|
// makes the bendGoals less responsive/less accurate.
|
||||||
|
|
||||||
//Funny thing is that IKTweaks specifically made this an option, which should be added to both CVR & Standable for the same reason.
|
//Funny thing is that IKTweaks specifically made this an option, which should be added to both CVR & Standable for the same reason.
|
||||||
|
|
||||||
/// Elbow / knee / chest bend goal offset - controls how far bend goal targets will be away from the actual joint.
|
/// Elbow / knee / chest bend goal offset - controls how far bend goal targets will be away from the actual joint.
|
||||||
/// Lower values should produce better precision with bent joint, higher values - better stability with straight joint.
|
/// Lower values should produce better precision with bent joint, higher values - better stability with straight joint.
|
||||||
/// Sensible range of values is between 0 and 1.
|
/// Sensible range of values is between 0 and 1.
|
||||||
|
@ -265,8 +248,6 @@ internal static class IKSystemPatches
|
||||||
__instance.applyOriginalHipRotation = true;
|
__instance.applyOriginalHipRotation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HumanPose _enforcementPose;
|
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(IKSystem), nameof(IKSystem.InitializeHalfBodyIK))]
|
[HarmonyPatch(typeof(IKSystem), nameof(IKSystem.InitializeHalfBodyIK))]
|
||||||
static void Prefix_IKSystem_InitializeHalfBodyIK(IKSystem __instance)
|
static void Prefix_IKSystem_InitializeHalfBodyIK(IKSystem __instance)
|
||||||
|
@ -278,19 +259,13 @@ internal static class IKSystemPatches
|
||||||
{
|
{
|
||||||
if (!IKFixes.EntryNetIKPass.Value) return;
|
if (!IKFixes.EntryNetIKPass.Value) return;
|
||||||
|
|
||||||
// This will enforce locally what we see over the network
|
Transform hips = __instance.animator.GetBoneTransform(HumanBodyBones.Hips);
|
||||||
if (__instance._poseHandler == null)
|
__instance._referenceRootPosition = hips.position;
|
||||||
__instance._poseHandler = new HumanPoseHandler(__instance.animator.avatar, __instance.animator.transform);
|
__instance._referenceRootRotation = hips.rotation;
|
||||||
|
__instance._poseHandler.GetHumanPose(ref __instance.humanPose);
|
||||||
Transform hipTransform = __instance.animator.GetBoneTransform(HumanBodyBones.Hips);
|
__instance._poseHandler.SetHumanPose(ref __instance.humanPose);
|
||||||
Vector3 hipPosition = hipTransform.position;
|
hips.position = __instance._referenceRootPosition;
|
||||||
Quaternion hipRotation = hipTransform.rotation;
|
hips.rotation = __instance._referenceRootRotation;
|
||||||
|
|
||||||
__instance._poseHandler.GetHumanPose(ref _enforcementPose);
|
|
||||||
__instance._poseHandler.SetHumanPose(ref _enforcementPose);
|
|
||||||
|
|
||||||
hipTransform.position = hipPosition;
|
|
||||||
hipTransform.rotation = hipRotation;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IKSystem._vrik.onPostSolverUpdate.AddListener(onPostSolverUpdate);
|
IKSystem._vrik.onPostSolverUpdate.AddListener(onPostSolverUpdate);
|
||||||
|
|
|
@ -25,11 +25,8 @@ public class IKFixes : MelonMod
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryAssignRemainingTrackers =
|
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?");
|
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> EntryAltElbowDirection =
|
|
||||||
Category.CreateEntry("Alt Elbow Direction", true, description: "Should bodyRotation be reset to identity when muscleupdate happens? Should fix chest tracking & tpose while running.");
|
|
||||||
|
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryNetIKPass =
|
public static readonly MelonPreferences_Entry<bool> EntryNetIKPass =
|
||||||
Category.CreateEntry("Network IK Pass", true, description: "Should NetIK pass be run?");
|
Category.CreateEntry("Network IK Pass", true, description: "Should NetIK pass be applied? This fixes a bunch of small rotation errors after VRIK is run.");
|
||||||
|
|
||||||
public override void OnInitializeMelon()
|
public override void OnInitializeMelon()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue