mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
Move many mods to Deprecated folder, fix spelling
This commit is contained in:
parent
5e822cec8d
commit
0042590aa6
539 changed files with 7475 additions and 3120 deletions
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk" />
|
143
.Deprecated/IKSimulatedRootAngleFix/Main.cs
Normal file
143
.Deprecated/IKSimulatedRootAngleFix/Main.cs
Normal file
|
@ -0,0 +1,143 @@
|
|||
using System.Reflection;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Systems.IK;
|
||||
using ABI_RC.Systems.IK.VRIKHandlers;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using ABI_RC.Systems.Movement;
|
||||
using HarmonyLib;
|
||||
using MelonLoader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.IKSimulatedRootAngleFix;
|
||||
|
||||
public class IKSimulatedRootAngleFixMod : MelonMod
|
||||
{
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
HarmonyInstance.Patch( // fix offsetting of _ikSimulatedRootAngle when player rotates on wall or ceiling
|
||||
typeof(IKHandler).GetMethod(nameof(IKHandler.OnPlayerHandleMovementParent),
|
||||
BindingFlags.Public | BindingFlags.Instance),
|
||||
prefix: new HarmonyMethod(typeof(IKSimulatedRootAngleFixMod).GetMethod(nameof(OnPlayerHandleMovementParent),
|
||||
BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
|
||||
HarmonyInstance.Patch( // fix offsetting of _ikSimulatedRootAngle when player rotates on wall or ceiling
|
||||
typeof(IKHandler).GetMethod(nameof(IKHandler.Reset),
|
||||
BindingFlags.Public | BindingFlags.Instance),
|
||||
postfix: new HarmonyMethod(typeof(IKSimulatedRootAngleFixMod).GetMethod(nameof(OnHandlerReset),
|
||||
BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
|
||||
HarmonyInstance.Patch( // why did i dupe logic weirdly between Desktop & VR IKHandler ...
|
||||
typeof(IKHandlerDesktop).GetMethod(nameof(IKHandlerDesktop.HandleBodyHeading),
|
||||
BindingFlags.NonPublic | BindingFlags.Instance),
|
||||
prefix: new HarmonyMethod(typeof(IKSimulatedRootAngleFixMod).GetMethod(nameof(OnHandleBodyHeading),
|
||||
BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
|
||||
HarmonyInstance.Patch( // why did i dupe logic weirdly between Desktop & VR IKHandler ...
|
||||
typeof(IKHandlerHalfBody).GetMethod(nameof(IKHandlerHalfBody.HandleRootAngle),
|
||||
BindingFlags.NonPublic | BindingFlags.Instance),
|
||||
prefix: new HarmonyMethod(typeof(IKSimulatedRootAngleFixMod).GetMethod(nameof(OnHandleRootAngle),
|
||||
BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
}
|
||||
|
||||
private static float GetRemappedPlayerHeading()
|
||||
{
|
||||
// invert, remap, then remap again so it matches playerlocal.eulerAngles.y that originally was used
|
||||
// NOTE: we want to still use GetPlayerHeading because it accounts for gravity (and cause exterrata helped with that method specifically :3)
|
||||
// NOTE: i am remapping it to match *original* DesktopVRIK logic before i reworked it native- dropping this remap into native method would not work
|
||||
var playerHeading = (-IKSystem.Instance.GetPlayerHeading() + 180) % 360;
|
||||
if (playerHeading < 0) playerHeading += 360;
|
||||
return playerHeading;
|
||||
}
|
||||
|
||||
private static bool OnPlayerHandleMovementParent(BetterBetterCharacterController.PlayerMoveOffset moveOffset, ref IKHandler __instance)
|
||||
{
|
||||
__instance._solver.AddPlatformMotion(moveOffset.DeltaPosition, moveOffset.DeltaRotation, moveOffset.PivotPosition);
|
||||
|
||||
Transform playerTransform = IKSystem.Instance.transform;
|
||||
Vector3 up = playerTransform.up; // for simplicity, we will just use the current up, instead of calc past up
|
||||
|
||||
Quaternion playerRotation = playerTransform.rotation;
|
||||
Quaternion deltaRotation = moveOffset.DeltaRotation;
|
||||
|
||||
// calculate the player's forward direction before the delta rotation was applied
|
||||
Quaternion originalRotation = Quaternion.Inverse(deltaRotation) * playerRotation;
|
||||
|
||||
Vector3 forwardBeforeRotation = Vector3.ProjectOnPlane(originalRotation * Vector3.forward, up).normalized;
|
||||
Vector3 forwardAfterRotation = Vector3.ProjectOnPlane(playerRotation * Vector3.forward, up).normalized;
|
||||
|
||||
// calculate the signed angle between the forward directions before and after the rotation around the up vector
|
||||
float headingDelta = Vector3.SignedAngle(forwardBeforeRotation, forwardAfterRotation, up);
|
||||
__instance._ikSimulatedRootAngle = Mathf.Repeat(__instance._ikSimulatedRootAngle + headingDelta, 360f);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void OnHandlerReset(ref IKHandler __instance)
|
||||
{
|
||||
__instance._ikSimulatedRootAngle = GetRemappedPlayerHeading();
|
||||
}
|
||||
|
||||
private static bool OnHandleBodyHeading(ref IKHandlerDesktop __instance)
|
||||
{
|
||||
if (IKSystem.Instance.BodyHeadingLimit <= 0f)
|
||||
return false;
|
||||
|
||||
float playerHeading = GetRemappedPlayerHeading();
|
||||
|
||||
// nicked original logic from DesktopVRIK, before i made it native and seemingly fucked it -_-
|
||||
// https://github.com/NotAKidoS/NAK_CVR_Mods/blob/db9d5a24b62c96e3c5c403ce3956cd3221955898/.DepricatedMods/DesktopVRIK/IK/IKHandlers/IKHandlerDesktop.cs#L68
|
||||
var weightedAngleLimit = IKSystem.Instance.BodyHeadingLimit * __instance._solver.locomotion.weight;
|
||||
var deltaAngleRoot = Mathf.DeltaAngle(playerHeading, __instance._ikSimulatedRootAngle);
|
||||
var absDeltaAngleRoot = Mathf.Abs(deltaAngleRoot);
|
||||
if (absDeltaAngleRoot > weightedAngleLimit)
|
||||
{
|
||||
deltaAngleRoot = Mathf.Sign(deltaAngleRoot) * weightedAngleLimit;
|
||||
__instance._ikSimulatedRootAngle = Mathf.MoveTowardsAngle(__instance._ikSimulatedRootAngle,
|
||||
playerHeading, absDeltaAngleRoot - weightedAngleLimit);
|
||||
}
|
||||
|
||||
__instance._solver.spine.rootHeadingOffset = deltaAngleRoot;
|
||||
|
||||
Vector3 axis = __instance._vrik.transform.rotation * Vector3.up;
|
||||
if (IKSystem.Instance.PelvisHeadingWeight > 0f)
|
||||
{
|
||||
__instance._solver.spine.pelvisRotationOffset *= Quaternion.AngleAxis(
|
||||
__instance._solver.spine.rootHeadingOffset * IKSystem.Instance.PelvisHeadingWeight, axis);
|
||||
__instance._solver.spine.chestRotationOffset *= Quaternion.AngleAxis(
|
||||
-__instance._solver.spine.rootHeadingOffset * IKSystem.Instance.PelvisHeadingWeight, axis);
|
||||
}
|
||||
|
||||
if (IKSystem.Instance.ChestHeadingWeight > 0f)
|
||||
__instance._solver.spine.chestRotationOffset *= Quaternion.AngleAxis(
|
||||
__instance._solver.spine.rootHeadingOffset * IKSystem.Instance.ChestHeadingWeight, axis);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool OnHandleRootAngle(ref IKHandlerHalfBody __instance)
|
||||
{
|
||||
float playerHeading = GetRemappedPlayerHeading();
|
||||
|
||||
var rootAngleLimit = 25f;
|
||||
if (__instance._solver.spine.rotationWeight <= 0f || PlayerSetup.Instance.IsEmotePlaying())
|
||||
rootAngleLimit = 180f;
|
||||
else if (CVRInputManager.Instance.movementVector.sqrMagnitude > 0f) rootAngleLimit = 0f;
|
||||
|
||||
var weightedAngleLimit = rootAngleLimit * __instance._solver.locomotion.weight;
|
||||
var deltaAngleRoot = Mathf.DeltaAngle(playerHeading, __instance._ikSimulatedRootAngle);
|
||||
var absDeltaAngleRoot = Mathf.Abs(deltaAngleRoot);
|
||||
if (absDeltaAngleRoot > weightedAngleLimit)
|
||||
{
|
||||
deltaAngleRoot = Mathf.Sign(deltaAngleRoot) * weightedAngleLimit;
|
||||
__instance._ikSimulatedRootAngle = Mathf.MoveTowardsAngle(__instance._ikSimulatedRootAngle,
|
||||
playerHeading, absDeltaAngleRoot - weightedAngleLimit);
|
||||
}
|
||||
|
||||
__instance._solver.spine.maxRootAngle = rootAngleLimit;
|
||||
__instance._solver.spine.rootHeadingOffset = deltaAngleRoot;
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
using MelonLoader;
|
||||
using NAK.IKSimulatedRootAngleFix.Properties;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyTitle(nameof(NAK.IKSimulatedRootAngleFix))]
|
||||
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||
[assembly: AssemblyProduct(nameof(NAK.IKSimulatedRootAngleFix))]
|
||||
|
||||
[assembly: MelonInfo(
|
||||
typeof(NAK.IKSimulatedRootAngleFix.IKSimulatedRootAngleFixMod),
|
||||
nameof(NAK.IKSimulatedRootAngleFix),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/IKSimulatedRootAngleFix"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
[assembly: MelonColor(255, 246, 25, 99)] // red-pink
|
||||
[assembly: MelonAuthorColor(255, 158, 21, 32)] // red
|
||||
[assembly: HarmonyDontPatchAll]
|
||||
|
||||
namespace NAK.IKSimulatedRootAngleFix.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
14
.Deprecated/IKSimulatedRootAngleFix/README.md
Normal file
14
.Deprecated/IKSimulatedRootAngleFix/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# IKSimulatedRootAngleFix
|
||||
|
||||
Fixes a small issue with Desktop & HalfBody root angle being incorrectly calculated while on rotating Movement Parents. If you've ever noticed your body/feet insisting on facing opposite of the direction you are rotating, this fixes that.
|
||||
|
||||
---
|
||||
|
||||
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
|
||||
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
|
||||
|
||||
> This mod is an independent creation not affiliated with, supported by, or approved by Alpha Blend Interactive.
|
||||
|
||||
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
|
||||
|
||||
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.
|
23
.Deprecated/IKSimulatedRootAngleFix/format.json
Normal file
23
.Deprecated/IKSimulatedRootAngleFix/format.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"_id": 218,
|
||||
"name": "IKSimulatedRootAngleFix",
|
||||
"modversion": "1.0.0",
|
||||
"gameversion": "2024r175",
|
||||
"loaderversion": "0.6.1",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "Fixes a small issue with Desktop & HalfBody root angle being incorrectly calculated while on rotating Movement Parents. If you've ever noticed your body/feet insisting on facing opposite of the direction you are rotating, this fixes that.",
|
||||
"searchtags": [
|
||||
"ik",
|
||||
"root",
|
||||
"angle",
|
||||
"burger"
|
||||
],
|
||||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r34/IKSimulatedRootAngleFix.dll",
|
||||
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/IKSimulatedRootAngleFix/",
|
||||
"changelog": "- Initial release",
|
||||
"embedcolor": "#f61963"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue