mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
RCCVirtualSteeringWheel: renamed mod, fixed things
This commit is contained in:
parent
3a00ff104a
commit
5c8c724b58
13 changed files with 445 additions and 314 deletions
47
RCCVirtualSteeringWheel/Patches.cs
Normal file
47
RCCVirtualSteeringWheel/Patches.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using ABI_RC.Systems.InputManagement;
|
||||
using ABI_RC.Systems.Movement;
|
||||
using HarmonyLib;
|
||||
using NAK.RCCVirtualSteeringWheel.Util;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.RCCVirtualSteeringWheel.Patches;
|
||||
|
||||
internal static class RCCCarControllerV3_Patches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(RCC_CarControllerV3), nameof(RCC_CarControllerV3.Awake))]
|
||||
private static void Postfix_RCC_CarControllerV3_Awake(RCC_CarControllerV3 __instance)
|
||||
{
|
||||
Transform steeringWheelTransform = __instance.SteeringWheel;
|
||||
if (steeringWheelTransform == null)
|
||||
return;
|
||||
|
||||
BoneVertexBoundsUtility.CalculateBoneWeightedBounds(
|
||||
steeringWheelTransform,
|
||||
0.8f,
|
||||
BoneVertexBoundsUtility.BoundsCalculationFlags.All,
|
||||
result =>
|
||||
{
|
||||
if (!result.IsValid)
|
||||
return;
|
||||
|
||||
SteeringWheelRoot.SetupSteeringWheel(__instance, result.LocalBounds);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
internal static class CVRInputManager_Patches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CVRInputManager), nameof(CVRInputManager.UpdateInput))]
|
||||
private static void Postfix_CVRInputManager_UpdateInput(ref CVRInputManager __instance)
|
||||
{
|
||||
// Steering input is clamped in RCC component
|
||||
if (BetterBetterCharacterController.Instance.IsSittingOnControlSeat()
|
||||
&& SteeringWheelRoot.TryGetWheelInput(
|
||||
BetterBetterCharacterController.Instance._lastCvrSeat._carController, out float steeringValue))
|
||||
{
|
||||
__instance.steering = steeringValue;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue