This commit is contained in:
SDraw 2023-07-28 01:26:14 +03:00
parent dae0d5c65b
commit 19032650a3
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
5 changed files with 36 additions and 10 deletions

View file

@ -3,7 +3,7 @@ Merged set of MelonLoader mods for ChilloutVR.
**Table for game build 2022r171:** **Table for game build 2022r171:**
| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | | Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) |
|:---------:|:----------:|:--------------:| :----------------------------------------------------------------| |:---------:|:----------:|:--------------:| :----------------------------------------------------------------|
| [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | - | ✔ Yes<br>:warning:Broken | | [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | 1.2.9 [:arrow_down:](../../releases/latest/download/ml_amt.dll)| ✔ Yes<br>:hourglass_flowing_sand: Update review |
| [Desktop Head Tracking](/ml_dht/README.md)| ml_dht | - | ✔ Yes<br>:warning:Broken | | [Desktop Head Tracking](/ml_dht/README.md)| ml_dht | - | ✔ Yes<br>:warning:Broken |
| [Desktop Reticle Switch](/ml_drs/README.md)| ml_drs | 1.0.1 [:arrow_down:](../../releases/latest/download/ml_drs.dll)| ✔ Yes<br>:hourglass_flowing_sand: Update review | | [Desktop Reticle Switch](/ml_drs/README.md)| ml_drs | 1.0.1 [:arrow_down:](../../releases/latest/download/ml_drs.dll)| ✔ Yes<br>:hourglass_flowing_sand: Update review |
| [Extended Game Notifications](/ml_egn/README.md) | ml_egn | 1.0.3 [:arrow_down:](../../releases/latest/download/ml_egn.dll)| ✔ Yes<br>:hourglass_flowing_sand: Update review | | [Extended Game Notifications](/ml_egn/README.md) | ml_egn | 1.0.3 [:arrow_down:](../../releases/latest/download/ml_egn.dll)| ✔ Yes<br>:hourglass_flowing_sand: Update review |

View file

@ -35,6 +35,11 @@ namespace ml_amt
null, null,
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnCalibrate_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnCalibrate_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
); );
HarmonyInstance.Patch(
typeof(PlayerSetup).GetMethod("SetPlaySpaceScale", BindingFlags.NonPublic | BindingFlags.Instance),
null,
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
);
// Fixes // Fixes
Fixes.AnimatorOverrideControllerFix.Init(HarmonyInstance); Fixes.AnimatorOverrideControllerFix.Init(HarmonyInstance);
@ -107,5 +112,19 @@ namespace ml_amt
MelonLoader.MelonLogger.Error(l_exception); MelonLoader.MelonLogger.Error(l_exception);
} }
} }
static void OnPlayspaceScale_Postfix() => ms_instance?.OnPlayspaceScale();
void OnPlayspaceScale()
{
try
{
if(m_localTweaker != null)
m_localTweaker.OnPlayspaceScale();
}
catch(Exception l_exception)
{
MelonLoader.MelonLogger.Error(l_exception);
}
}
} }
} }

View file

@ -196,9 +196,17 @@ namespace ml_amt
BodySystem.TrackingLeftLegEnabled = false; BodySystem.TrackingLeftLegEnabled = false;
BodySystem.TrackingRightLegEnabled = false; BodySystem.TrackingRightLegEnabled = false;
BodySystem.TrackingLocomotionEnabled = true; BodySystem.TrackingLocomotionEnabled = true;
IKSystem.Instance.applyOriginalHipRotation = true;
} }
} }
internal void OnPlayspaceScale()
{
if((m_vrIk != null) && Settings.MassCenter)
m_vrIk.solver.locomotion.offset = m_massCenter * GetRelativeScale();
}
// IK events // IK events
void OnIKPreUpdate() void OnIKPreUpdate()
{ {
@ -239,15 +247,20 @@ namespace ml_amt
} }
bool l_solverActive = !Mathf.Approximately(m_vrIk.solver.IKPositionWeight, 0f); bool l_solverActive = !Mathf.Approximately(m_vrIk.solver.IKPositionWeight, 0f);
if(l_locomotionOverride && l_solverActive && m_followHips && (!m_moving || (PlayerSetup.Instance.avatarUpright <= PlayerSetup.Instance.avatarProneLimit)) && m_inVR && !BodySystem.isCalibratedAsFullBody && !ModSupporter.SkipHipsOverride()) if(l_locomotionOverride && l_solverActive && m_followHips && (!m_moving || (PlayerSetup.Instance.avatarUpright <= PlayerSetup.Instance.avatarCrouchLimit)) && m_inVR && !BodySystem.isCalibratedAsFullBody && !ModSupporter.SkipHipsOverride())
{ {
m_vrIk.solver.plantFeet = false; m_vrIk.solver.plantFeet = false;
IKSystem.VrikRootController.enabled = false; if(IKSystem.VrikRootController != null)
IKSystem.VrikRootController.enabled = false;
PlayerSetup.Instance._avatar.transform.localPosition = m_hipsToPlayer; PlayerSetup.Instance._avatar.transform.localPosition = m_hipsToPlayer;
} }
if(m_locomotionOverride && !l_locomotionOverride) if(m_locomotionOverride && !l_locomotionOverride)
{
m_vrIk.solver.Reset(); m_vrIk.solver.Reset();
if(IKSystem.VrikRootController != null)
IKSystem.VrikRootController.enabled = true;
}
m_locomotionOverride = l_locomotionOverride; m_locomotionOverride = l_locomotionOverride;
} }

View file

@ -37,7 +37,4 @@ Available additional parameters for AAS animator:
* Note: Can be set as local-only (not synced) if starts with `#` character. * Note: Can be set as local-only (not synced) if starts with `#` character.
Additional mod's behaviour: Additional mod's behaviour:
* Overrides and fixes IK behaviour in 4PT mode (head, hands and hips). * Overrides and fixes IK behaviour in 4PT mode (head, hands and hips).
# NOTE
This is testing update for game build r171, not ready for massive usage yet!

View file

@ -13,7 +13,6 @@ namespace ml_amt
static readonly FieldInfo ms_groundedRaw = typeof(MovementSystem).GetField("_isGroundedRaw", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_groundedRaw = typeof(MovementSystem).GetField("_isGroundedRaw", BindingFlags.NonPublic | BindingFlags.Instance);
static readonly FieldInfo ms_hasToes = typeof(IKSolverVR).GetField("hasToes", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_hasToes = typeof(IKSolverVR).GetField("hasToes", BindingFlags.NonPublic | BindingFlags.Instance);
static MethodInfo ms_getSineKeyframes = typeof(IKSolverVR).GetMethod("GetSineKeyframes", BindingFlags.NonPublic | BindingFlags.Static); static MethodInfo ms_getSineKeyframes = typeof(IKSolverVR).GetMethod("GetSineKeyframes", BindingFlags.NonPublic | BindingFlags.Static);
static FieldInfo ms_cohtmlView = typeof(CohtmlControlledViewDisposable).GetField("_view", BindingFlags.NonPublic | BindingFlags.Instance);
public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded); public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded);
@ -47,8 +46,6 @@ namespace ml_amt
return l_result; return l_result;
} }
public static void ExecuteScript(this CohtmlControlledViewDisposable p_instance, string p_script) => ((cohtml.Net.View)ms_cohtmlView.GetValue(p_instance))?.ExecuteScript(p_script);
// Engine extensions // Engine extensions
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false) public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
{ {