mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 18:39:23 +00:00
AMT fix
This commit is contained in:
parent
dae0d5c65b
commit
19032650a3
5 changed files with 36 additions and 10 deletions
|
@ -3,7 +3,7 @@ Merged set of MelonLoader mods for ChilloutVR.
|
|||
**Table for game build 2022r171:**
|
||||
| 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 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 |
|
||||
|
|
|
@ -35,6 +35,11 @@ namespace ml_amt
|
|||
null,
|
||||
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.AnimatorOverrideControllerFix.Init(HarmonyInstance);
|
||||
|
@ -107,5 +112,19 @@ namespace ml_amt
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,9 +196,17 @@ namespace ml_amt
|
|||
BodySystem.TrackingLeftLegEnabled = false;
|
||||
BodySystem.TrackingRightLegEnabled = false;
|
||||
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
|
||||
void OnIKPreUpdate()
|
||||
{
|
||||
|
@ -239,15 +247,20 @@ namespace ml_amt
|
|||
}
|
||||
|
||||
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;
|
||||
if(IKSystem.VrikRootController != null)
|
||||
IKSystem.VrikRootController.enabled = false;
|
||||
PlayerSetup.Instance._avatar.transform.localPosition = m_hipsToPlayer;
|
||||
}
|
||||
|
||||
if(m_locomotionOverride && !l_locomotionOverride)
|
||||
{
|
||||
m_vrIk.solver.Reset();
|
||||
if(IKSystem.VrikRootController != null)
|
||||
IKSystem.VrikRootController.enabled = true;
|
||||
}
|
||||
m_locomotionOverride = l_locomotionOverride;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,3 @@ Available additional parameters for AAS animator:
|
|||
|
||||
Additional mod's behaviour:
|
||||
* 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!
|
|
@ -13,7 +13,6 @@ namespace ml_amt
|
|||
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 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);
|
||||
|
||||
|
@ -47,8 +46,6 @@ namespace ml_amt
|
|||
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
|
||||
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue