[NAK_CVR_Mods] Unfucked for 2026r182

This commit is contained in:
NotAKid 2026-06-18 22:20:56 -05:00
parent c13dc8375a
commit 281403d68b
209 changed files with 3936 additions and 1122 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>ASTExtension</RootNamespace>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,203 @@
using System.Reflection;
using ABI_RC.Core.Extensions;
using ABI_RC.Systems.IK;
using ABI_RC.Systems.IK.SubSystems;
using HarmonyLib;
using MelonLoader;
using UnityEngine;
namespace NAK.DisableInputDuringFingerTracking;
public class DisableInputDuringFingerTrackingMod : MelonMod
{
private static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(nameof(DisableInputDuringFingerTracking));
private static readonly MelonPreferences_Entry<Fixes> EntryProbableFixes =
Category.CreateEntry("probable_fixes", Fixes.Fix1,
"Fixes", description: "remove me from ur melonpref one day");
private enum Fixes
{
Fix1,
Fix2,
Fix3
}
public override void OnInitializeMelon()
{
HarmonyInstance.Patch(
typeof(BodySystem).GetMethod(nameof(BodySystem.CalibrateWithSavedData),
BindingFlags.Public | BindingFlags.Instance),
prefix: new HarmonyMethod(typeof(DisableInputDuringFingerTrackingMod).GetMethod(nameof(CalibrateWithSavedData),
BindingFlags.NonPublic | BindingFlags.Static))
);
HarmonyInstance.Patch(
typeof(BodySystem).GetMethod(nameof(BodySystem.SaveCalibrationData),
BindingFlags.Public | BindingFlags.Instance),
prefix: new HarmonyMethod(typeof(DisableInputDuringFingerTrackingMod).GetMethod(nameof(SaveCalibrationData),
BindingFlags.NonPublic | BindingFlags.Static))
);
}
private static void CalibrateWithSavedData(BodySystem.CalibrationData data, BodySystem __instance, ref bool __runOriginal)
{
__runOriginal = false;
Vector3 scale = IKSystem.Instance._vrPlaySpace.localScale;
Vector3 position = data.AvatarPosition;
position.x *= scale.x;
position.y *= scale.y;
position.z *= scale.z;
// IKSystem.vrik.transform.SetLocalPositionAndRotation(position, data.AvatarRotation);
// need to set relative to IKSystem.Instance._vrPlaySpace
switch (EntryProbableFixes.Value)
{
case Fixes.Fix1:
IKSystem.vrik.transform.SetPositionAndRotation(
IKSystem.Instance._vrPlaySpace.TransformPointNoScale(position),
IKSystem.Instance._vrPlaySpace.rotation * data.AvatarRotation);
break;
case Fixes.Fix2:
IKSystem.vrik.transform.SetPositionAndRotation(
IKSystem.Instance._vrPlaySpace.TransformPointNoScale(position),
data.AvatarRotation);
break;
// Position relative to playspace position only, ignore playspace rotation.
case Fixes.Fix3:
IKSystem.vrik.transform.SetPositionAndRotation(
IKSystem.Instance._vrPlaySpace.position + position,
data.AvatarRotation);
break;
}
List<TrackingPoint> validTrackers = IKSystem.Instance.TrackingSystem.AllTrackingPoints.FindAll(m =>
m.isActive &&
m.isValid &&
m.suggestedRole != TrackingPoint.TrackingRole.Invalid
);
foreach (BodySystem.CalibrationPoint calibrationPoint in data.CalibrationPoints)
{
foreach (var tracker in validTrackers)
{
if (tracker.identifier == calibrationPoint.TrackerSerial)
{
tracker.assignedRole = calibrationPoint.TrackingRole;
tracker.position = calibrationPoint.LocalPosition;
tracker.rotation = calibrationPoint.LocalRotation;
tracker.referenceTransform.localPosition = calibrationPoint.LocalPosition;
tracker.referenceTransform.localRotation = calibrationPoint.LocalRotation;
}
}
}
__instance.SetupOffsets(validTrackers);
// #if UNITY_EDITOR
// UnityEditor.EditorApplication.isPaused = true;
// #endif
__instance.Calibrate(false);
}
private static void SaveCalibrationData(string avatarId, BodySystem __instance, ref bool __runOriginal)
{
__runOriginal = false;
// needs to be relative to vr playspace
Vector3 position = IKSystem.Instance._vrPlaySpace.InverseTransformPoint(IKSystem.vrik.transform.position);
Quaternion rotation = Quaternion.Inverse(IKSystem.Instance._vrPlaySpace.rotation) * IKSystem.vrik.transform.rotation;
switch (EntryProbableFixes.Value)
{
// Load:
// TransformPointNoScale(position)
// playspace.rotation * avatarRotation
case Fixes.Fix1:
{
position = IKSystem.Instance._vrPlaySpace.InverseTransformPointNoScale(IKSystem.vrik.transform.position);
Vector3 scale = IKSystem.Instance._vrPlaySpace.localScale;
position.x /= scale.x;
position.y /= scale.y;
position.z /= scale.z;
rotation = Quaternion.Inverse(IKSystem.Instance._vrPlaySpace.rotation) *
IKSystem.vrik.transform.rotation;
break;
}
// Load:
// TransformPointNoScale(position)
// avatarRotation
case Fixes.Fix2:
{
position = IKSystem.Instance._vrPlaySpace.InverseTransformPointNoScale(IKSystem.vrik.transform.position);
Vector3 scale = IKSystem.Instance._vrPlaySpace.localScale;
position.x /= scale.x;
position.y /= scale.y;
position.z /= scale.z;
rotation = IKSystem.vrik.transform.rotation;
break;
}
// Load:
// playspace.position + position
// avatarRotation
case Fixes.Fix3:
{
position = IKSystem.vrik.transform.position -
IKSystem.Instance._vrPlaySpace.position;
Vector3 scale = IKSystem.Instance._vrPlaySpace.localScale;
position.x /= scale.x;
position.y /= scale.y;
position.z /= scale.z;
rotation = IKSystem.vrik.transform.rotation;
break;
}
}
BodySystem.UniversalData = new BodySystem.CalibrationData(
position,
rotation,
avatarId
);
List<TrackingPoint> validTrackers = IKSystem.Instance.TrackingSystem.AllTrackingPoints.FindAll(m =>
m.isActive &&
m.isValid &&
m.suggestedRole != TrackingPoint.TrackingRole.Invalid &&
m.assignedRole != TrackingPoint.TrackingRole.Invalid &&
m.assignedRole != TrackingPoint.TrackingRole.Generic
);
BodySystem.UniversalData.CalibrationPoints.Clear();
foreach (var tracker in validTrackers)
{
BodySystem.CalibrationPoint point = new BodySystem.CalibrationPoint(
tracker.position,
tracker.rotation,
tracker.assignedRole,
tracker.identifier
);
BodySystem.UniversalData.CalibrationPoints.Add(point);
}
// save to universal
if (BodySystem.enableUniversalCalibration) BodySystem.SavedAvatars[BodySystem.UniversalCalibrationKey] = BodySystem.UniversalData;
// save to current avatar
if (BodySystem.enableSaveCalibration) BodySystem.SavedAvatars[avatarId] = BodySystem.UniversalData;
// save to file
if (BodySystem.enableUniversalCalibration || BodySystem.enableSaveCalibration) __instance.SaveSavedCalibrations();
}
}

View file

@ -0,0 +1,32 @@
using MelonLoader;
using NAK.DisableInputDuringFingerTracking.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.DisableInputDuringFingerTracking))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.DisableInputDuringFingerTracking))]
[assembly: MelonInfo(
typeof(NAK.DisableInputDuringFingerTracking.DisableInputDuringFingerTrackingMod),
nameof(NAK.DisableInputDuringFingerTracking),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/DisableInputDuringFingerTracking"
)]
[assembly: MelonGame("ChilloutVR", "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.DisableInputDuringFingerTracking.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Author = "NotAKidoS";
}

View file

@ -0,0 +1,54 @@
# ASTExtension
Extension mod for [Avatar Scale Tool](https://github.com/NotAKidoS/AvatarScaleTool):
- VR Gesture to scale
- Persistent height
- Copy height from others
Best used with Avatar Scale Tool, but will attempt to work with found scaling setups.
Requires already having Avatar Scaling on the avatar. This is **not** Universal Scaling.
## Supported Setups
ASTExtension will attempt to work with the following setups:
**Parameter Names:**
- AvatarScale
- Scale
- Scaler
- Scale/Scale
- Height
- LoliModifier
- AvatarSize
- Size
- SizeScale
- Scaling
These parameter names are not case sensitive and have been gathered from polling the community for common parameter names.
Assuming the parameter is a float, ASTExtension will attempt to use it as the height parameter. Will automatically calibrate to the height range of the found parameter, assuming the scaling animation is in a blend tree / state using motion time & is linear. The scaling animation state **must be active** at time of avatar load.
The max value ASTExtension will drive the parameter to is 100. As the mod is having to guess the max height, it may not be accurate if the max height is not capped at a multiple of 10.
Examples:
- `AvatarScale` - 0 to 1 (slider)
- This is the default setup for Avatar Scale Tool and will work perfectly.
- `Scale` - 0 to 100 (input single)
- This will also work perfectly as the max height is a multiple of 10.
- `Height` - 0 to 2 (input single)
- This will not work properly. The max value to drive the parameter to is not a multiple of 10, and as such ASTExtension will believe the parameter range is 0 to 1.
- `BurntToast` - 0 to 10 (input single)
- This will not work properly. The parameter name is not recognized by ASTExtension.
If your setup is theoretically supported but not working, it is likely the scaling animation is not linear or has loop enabled if using Motion Time, making the first and last frame identical height. In this case, you will need to fix your animation clip curves / blend tree to be linear &|| not loop, or use Avatar Scale Tool to generate a new scaling animation.
---
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ChilloutVR.
https://docs.chilloutvr.net/official/legal/tos/#6-modding-our-game
> This mod is an independent creation not affiliated with, supported by, or approved by ChilloutVR.
> 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 ChilloutVR.

View file

@ -0,0 +1,24 @@
{
"_id": 223,
"name": "ASTExtension",
"modversion": "1.0.5",
"gameversion": "2025r181",
"loaderversion": "0.7.2",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Extension mod for [Avatar Scale Tool](https://github.com/NotAKidoS/AvatarScaleTool):\n- VR Gesture to scale\n- Persistent height\n- Copy height from others\n\nBest used with Avatar Scale Tool, but will attempt to work with found scaling setups.\nRequires already having Avatar Scaling on the avatar. This is **not** Universal Scaling.",
"searchtags": [
"tool",
"scaling",
"height",
"extension",
"avatar"
],
"requirements": [
"BTKUILib"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r48/ASTExtension.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/ASTExtension/",
"changelog": "- Rebuilt for CVR 2025r181",
"embedcolor": "#f61963"
}