Custom Components & Managed Libs

This commit is contained in:
NotAKidoS 2023-04-19 21:24:58 -05:00
parent d5a2b8d2df
commit abad2dfb8a
12 changed files with 413 additions and 8 deletions

View file

@ -87,12 +87,12 @@ internal static class BodySystemPatches
SetPelvisWeight(solver.spine, 0f);
}
if (IKFixesMod.EntryUseFakeRootAngle.Value && !BodySystem.isCalibratedAsFullBody)
if (IKFixes.EntryUseFakeRootAngle.Value && !BodySystem.isCalibratedAsFullBody)
{
// Emulate maxRootAngle because CVR doesn't have the player controller set up ideally for VRIK.
// This is a small small fix, but makes it so the feet dont point in the direction of the head
// when turning. It also means turning with joystick & turning IRL make feet behave the same and follow behind.
float weightedAngleLimit = IKFixesMod.EntryFakeRootAngleLimit.Value * solver.locomotion.weight;
float weightedAngleLimit = IKFixes.EntryFakeRootAngleLimit.Value * solver.locomotion.weight;
float pivotAngle = MovementSystem.Instance.rotationPivot.eulerAngles.y;
float deltaAngleRoot = Mathf.DeltaAngle(pivotAngle, _ikSimulatedRootAngle);
float absDeltaAngleRoot = Mathf.Abs(deltaAngleRoot);
@ -111,6 +111,11 @@ internal static class BodySystemPatches
// VR default is 25 degrees, but maybe during emotes needs 180 degrees..?
solver.spine.maxRootAngle = BodySystem.isCalibratedAsFullBody ? 0f : 25f;
}
// custom IK settings
solver.spine.neckStiffness = IKFixes.EntryNeckStiffness.Value;
solver.spine.bodyRotStiffness = IKFixes.EntryBodyRotStiffness.Value;
solver.spine.rotateChestByHands = IKFixes.EntryRotateChestByHands.Value;
}
int num = 0;

View file

@ -2,16 +2,25 @@
namespace NAK.Melons.IKFixes;
public class IKFixesMod : MelonMod
public class IKFixes : MelonMod
{
public const string SettingsCategory = "IKFixes";
public static readonly MelonPreferences_Category CategoryIKFixes = MelonPreferences.CreateCategory(SettingsCategory);
public const string SettingsCategory = nameof(IKFixes);
public static readonly MelonPreferences_Category Category = MelonPreferences.CreateCategory(SettingsCategory);
public static readonly MelonPreferences_Entry<bool> EntryUseFakeRootAngle =
CategoryIKFixes.CreateEntry("Use Fake Root Angle", true, description: "Emulates maxRootAngle. This fixes feet pointing in direction of head when looking around.");
Category.CreateEntry("Use Fake Root Angle", true, description: "Emulates maxRootAngle. This fixes feet pointing in direction of head when looking around.");
public static readonly MelonPreferences_Entry<float> EntryFakeRootAngleLimit =
CategoryIKFixes.CreateEntry("Fake Root Angle Limit", 25f, description: "Specifies the maximum angle the lower body can have relative to the head when rotating.");
Category.CreateEntry("Fake Root Angle Limit", 25f, description: "Specifies the maximum angle the lower body can have relative to the head when rotating.");
public static readonly MelonPreferences_Entry<float> EntryNeckStiffness =
Category.CreateEntry("Neck Stiffness", 0.2f, description: "Neck stiffness.");
public static readonly MelonPreferences_Entry<float> EntryBodyRotStiffness =
Category.CreateEntry("Body Rot Stiffness", 0.1f, description: "Body rotation stiffness.");
public static readonly MelonPreferences_Entry<float> EntryRotateChestByHands =
Category.CreateEntry("Rot Chest By Hands", 1f, description: "Rotate chest by hands.");
public override void OnInitializeMelon()
{

View file

@ -10,7 +10,7 @@ using System.Reflection;
[assembly: AssemblyProduct(nameof(NAK.Melons.IKFixes))]
[assembly: MelonInfo(
typeof(NAK.Melons.IKFixes.IKFixesMod),
typeof(NAK.Melons.IKFixes.IKFixes),
nameof(NAK.Melons.IKFixes),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,