mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
SmoothRay: brought back from the dead
This commit is contained in:
parent
a51d5812e7
commit
a168619d19
9 changed files with 95 additions and 52 deletions
|
@ -1,14 +0,0 @@
|
||||||
using ABI_RC.Core.Player;
|
|
||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
namespace NAK.SmoothRay.HarmonyPatches;
|
|
||||||
|
|
||||||
internal class PlayerSetupPatches
|
|
||||||
{
|
|
||||||
[HarmonyPostfix]
|
|
||||||
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))]
|
|
||||||
private static void Postfix_PlayerSetup_Start(ref PlayerSetup __instance)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
using MelonLoader;
|
|
||||||
|
|
||||||
namespace NAK.SmoothRay;
|
|
||||||
|
|
||||||
// ChilloutVR adaptation of:
|
|
||||||
// https://github.com/kinsi55/BeatSaber_SmoothedController
|
|
||||||
// https://github.com/kinsi55/BeatSaber_SmoothedController/blob/master/LICENSE
|
|
||||||
|
|
||||||
public class SmoothRay : MelonMod
|
|
||||||
{
|
|
||||||
public override void OnInitializeMelon()
|
|
||||||
{
|
|
||||||
ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyPatches(Type type)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
HarmonyInstance.PatchAll(type);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
|
||||||
LoggerInstance.Error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -77,6 +77,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WhereAmIPointing", "WhereAm
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvatarScaleMod", "AvatarScaleMod\AvatarScaleMod.csproj", "{A38E687F-8B6B-499E-ABC9-BD95C53DD391}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvatarScaleMod", "AvatarScaleMod\AvatarScaleMod.csproj", "{A38E687F-8B6B-499E-ABC9-BD95C53DD391}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmoothRay", "SmoothRay\SmoothRay.csproj", "{99F9D60D-9A2D-4DBE-AA52-13D8A0838696}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -231,6 +233,10 @@ Global
|
||||||
{A38E687F-8B6B-499E-ABC9-BD95C53DD391}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A38E687F-8B6B-499E-ABC9-BD95C53DD391}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A38E687F-8B6B-499E-ABC9-BD95C53DD391}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A38E687F-8B6B-499E-ABC9-BD95C53DD391}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{A38E687F-8B6B-499E-ABC9-BD95C53DD391}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A38E687F-8B6B-499E-ABC9-BD95C53DD391}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{99F9D60D-9A2D-4DBE-AA52-13D8A0838696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{99F9D60D-9A2D-4DBE-AA52-13D8A0838696}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{99F9D60D-9A2D-4DBE-AA52-13D8A0838696}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{99F9D60D-9A2D-4DBE-AA52-13D8A0838696}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
76
SmoothRay/Main.cs
Normal file
76
SmoothRay/Main.cs
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using HarmonyLib;
|
||||||
|
using MelonLoader;
|
||||||
|
|
||||||
|
namespace NAK.SmoothRay;
|
||||||
|
|
||||||
|
// ChilloutVR adaptation of:
|
||||||
|
// https://github.com/kinsi55/BeatSaber_SmoothedController
|
||||||
|
// https://github.com/kinsi55/BeatSaber_SmoothedController/blob/master/LICENSE
|
||||||
|
|
||||||
|
public class SmoothRay : MelonMod
|
||||||
|
{
|
||||||
|
#region Melon Preferences
|
||||||
|
|
||||||
|
public static readonly MelonPreferences_Category Category =
|
||||||
|
MelonPreferences.CreateCategory(nameof(SmoothRay));
|
||||||
|
|
||||||
|
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||||
|
Category.CreateEntry("Enable Smoothing", true,
|
||||||
|
description: "Enable or disable smoothing.");
|
||||||
|
|
||||||
|
public static readonly MelonPreferences_Entry<bool> EntryMenuOnly =
|
||||||
|
Category.CreateEntry("Menu Only", true,
|
||||||
|
description: "Only use smoothing on Main Menu and Quick Menu. This will be fine for most users, but it may be desired on pickups & Unity UI elements too.");
|
||||||
|
|
||||||
|
public static readonly MelonPreferences_Entry<float> EntryPositionSmoothing =
|
||||||
|
Category.CreateEntry("Position Smoothing", 3f,
|
||||||
|
description: "How much to smooth position changes by. Use the slider to adjust the position smoothing factor. Range: 0 to 20.");
|
||||||
|
|
||||||
|
public static readonly MelonPreferences_Entry<float> EntryRotationSmoothing =
|
||||||
|
Category.CreateEntry("Rotation Smoothing", 12f,
|
||||||
|
description: "How much to smooth rotation changes by. Use the slider to adjust the rotation smoothing factor. Range: 0 to 20.");
|
||||||
|
|
||||||
|
public static readonly MelonPreferences_Entry<float> EntrySmallMovementThresholdAngle =
|
||||||
|
Category.CreateEntry("Small Angle Threshold", 6f,
|
||||||
|
description: "Angle difference to consider a 'small' movement. The less shaky your hands are, the lower you probably want to set this. This is probably the primary value you want to tweak. Use the slider to adjust the threshold angle. Range: 4 to 15.");
|
||||||
|
|
||||||
|
#endregion Melon Preferences
|
||||||
|
|
||||||
|
#region Melon Events
|
||||||
|
|
||||||
|
public override void OnInitializeMelon()
|
||||||
|
{
|
||||||
|
ApplyPatches(typeof(PlayerSetup_Patches));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyPatches(Type type)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HarmonyInstance.PatchAll(type);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||||
|
LoggerInstance.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Melon Events
|
||||||
|
|
||||||
|
#region Harmony Patches
|
||||||
|
|
||||||
|
internal static class PlayerSetup_Patches
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))]
|
||||||
|
private static void Postfix_PlayerSetup_Start(ref PlayerSetup __instance)
|
||||||
|
{
|
||||||
|
__instance.vrLeftHandTracker.gameObject.AddComponent<SmoothRayer>().ray = __instance.vrRayLeft;
|
||||||
|
__instance.vrRightHandTracker.gameObject.AddComponent<SmoothRayer>().ray = __instance.vrRayRight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Harmony Patches
|
||||||
|
}
|
|
@ -20,14 +20,14 @@ using System.Reflection;
|
||||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
[assembly: MelonColor(255, 220, 130, 5)]
|
[assembly: MelonColor(255, 246, 25, 99)] // red-pink
|
||||||
[assembly: MelonAuthorColor(255, 158, 21, 32)]
|
[assembly: MelonAuthorColor(255, 158, 21, 32)] // red
|
||||||
[assembly: HarmonyDontPatchAll]
|
[assembly: HarmonyDontPatchAll]
|
||||||
|
|
||||||
namespace NAK.SmoothRay.Properties;
|
namespace NAK.SmoothRay.Properties;
|
||||||
|
|
||||||
internal static class AssemblyInfoParams
|
internal static class AssemblyInfoParams
|
||||||
{
|
{
|
||||||
public const string Version = "1.0.3";
|
public const string Version = "1.0.4";
|
||||||
public const string Author = "NotAKidoS";
|
public const string Author = "NotAKidoS";
|
||||||
}
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
# SmoothRay
|
# SmoothRay
|
||||||
|
|
||||||
Smoothes your controller while using the Quick and Main menus to make it easier to navigate.
|
Smoothes your controller while using the Quick and Main menus to make it easier to navigate.
|
||||||
|
This is a CVR adaptation of a Beat Saber mod: [BeatSaber_SmoothedController](https://github.com/kinsi55/BeatSaber_SmoothedController)
|
||||||
|
|
||||||
|
**Only supports OpenVR, not OpenXR.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -131,8 +131,8 @@ public class SmoothRayer : MonoBehaviour
|
||||||
_menuOnly = SmoothRay.EntryMenuOnly.Value;
|
_menuOnly = SmoothRay.EntryMenuOnly.Value;
|
||||||
_smallMovementThresholdAngle = SmoothRay.EntrySmallMovementThresholdAngle.Value;
|
_smallMovementThresholdAngle = SmoothRay.EntrySmallMovementThresholdAngle.Value;
|
||||||
// dont let value hit 0, itll freeze controllers
|
// dont let value hit 0, itll freeze controllers
|
||||||
_positionSmoothingValue = Math.Max(20f - Mathf.Clamp(SmoothRay.EntryPositionSmoothing.Value, 0f, 20f), 0.1f);
|
_positionSmoothingValue = Mathf.Max(20f - Mathf.Clamp(SmoothRay.EntryPositionSmoothing.Value, 0f, 20f), 0.1f);
|
||||||
_rotationSmoothingValue = Math.Max(20f - Mathf.Clamp(SmoothRay.EntryRotationSmoothing.Value, 0f, 20f), 0.1f);
|
_rotationSmoothingValue = Mathf.Max(20f - Mathf.Clamp(SmoothRay.EntryRotationSmoothing.Value, 0f, 20f), 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAppliedPoses()
|
private void OnAppliedPoses()
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"_id": 162,
|
"_id": 162,
|
||||||
"name": "SmoothRay",
|
"name": "SmoothRay",
|
||||||
"modversion": "1.0.3",
|
"modversion": "1.0.4",
|
||||||
"gameversion": "2023r172",
|
"gameversion": "2024r176",
|
||||||
"loaderversion": "0.6.1",
|
"loaderversion": "0.6.1",
|
||||||
"modtype": "Mod",
|
"modtype": "Mod",
|
||||||
"author": "NotAKidoS",
|
"author": "NotAKidoS",
|
||||||
"description": "Smoothes your controller while using the Quick and Main menus to make it easier to navigate.\nThis is a CVR adaptation of a Beat Saber mod: [BeatSaber_SmoothedController](https://github.com/kinsi55/BeatSaber_SmoothedController)\n\nSupport for TrackedControllerFix & DesktopVRSwitch.\n**Only supports OpenVR, not OpenXR.**",
|
"description": "Smoothes your controller while using the Quick and Main menus to make it easier to navigate.\nThis is a CVR adaptation of a Beat Saber mod: [BeatSaber_SmoothedController](https://github.com/kinsi55/BeatSaber_SmoothedController)\n\n**Only supports OpenVR, not OpenXR.**",
|
||||||
"searchtags": [
|
"searchtags": [
|
||||||
"vr",
|
"vr",
|
||||||
"ray",
|
"ray",
|
||||||
|
@ -18,6 +18,6 @@
|
||||||
],
|
],
|
||||||
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r21/SmoothRay.dll",
|
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r21/SmoothRay.dll",
|
||||||
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/SmoothRay/",
|
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/SmoothRay/",
|
||||||
"changelog": "- Fixes for 2023r172. Literally just recompiled.",
|
"changelog": "- Fixed for 2024r176.",
|
||||||
"embedcolor": "#dc8105"
|
"embedcolor": "#f61963"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue