Additional FBT checks

This commit is contained in:
SDraw 2022-09-03 17:00:18 +03:00
parent f61e1b20c5
commit 78bce5e34e
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
5 changed files with 28 additions and 14 deletions

View file

@ -4,8 +4,8 @@ Merged set of MelonLoader mods for ChilloutVR.
| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | Current Status | Notes |
|-----------|------------|----------------|-----------------------------------------------------------------|----------------|-------|
| Avatar Change Info | ml_aci | 1.0.1 | Yes | Working |
| Avatar Motion Tweaker | ml_amt | 1.0.5 | Yes, 1.0.3 | Working | FBT autostep problem |
| Avatar Motion Tweaker | ml_amt | 1.0.6 | Pending | Working |
| Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working |
| Four Point Tracking | ml_fpt | 1.0.2 | Yes | Working |
| Four Point Tracking | ml_fpt | 1.0.3 | Pending | Working |
| Leap Motion Extension | ml_lme | 1.1.7 | Pending | Working |
| Server Connection Info | ml_sci | 1.0.1 | Yes | Working |

View file

@ -1,4 +1,5 @@
using ABI_RC.Core.Player;
using RootMotion.FinalIK;
using System.Collections.Generic;
using UnityEngine;
@ -6,6 +7,8 @@ namespace ml_amt
{
class MotionTweaker : MonoBehaviour
{
static System.Reflection.FieldInfo ms_rootVelocity = typeof(IKSolverVR).GetField("rootVelocity", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
enum ParameterType
{
Upright
@ -26,7 +29,8 @@ namespace ml_amt
static readonly Vector4 ms_pointVector = new Vector4(0f, 0f, 0f, 1f);
RootMotion.FinalIK.VRIK m_vrIk = null;
CVR_IK_Calibrator m_ikCalibrator = null;
VRIK m_vrIk = null;
bool m_ready = false;
@ -46,6 +50,11 @@ namespace ml_amt
m_parameters = new List<AdditionalParameterInfo>();
}
void Start()
{
m_ikCalibrator = this.GetComponent<CVR_IK_Calibrator>();
}
void Update()
{
if(m_ready)
@ -55,14 +64,19 @@ namespace ml_amt
float l_currentHeight = Mathf.Clamp((l_hmdMatrix * ms_pointVector).y, 0f, float.MaxValue);
float l_avatarViewHeight = Mathf.Clamp(PlayerSetup.Instance.GetViewPointHeight() * PlayerSetup.Instance._avatar.transform.localScale.y, 0f, float.MaxValue);
m_currentUpright = Mathf.Clamp((((l_currentHeight > 0f) && (l_avatarViewHeight > 0f)) ? (l_currentHeight / l_avatarViewHeight) : 0f), 0f, 1f);
m_standing = (m_currentUpright > m_crouchLimit);
bool l_standing = (m_currentUpright > m_crouchLimit);
if((m_vrIk != null) && m_vrIk.enabled && !PlayerSetup.Instance._movementSystem.sitting && (PlayerSetup.Instance._movementSystem.movementVector.magnitude <= Mathf.Epsilon) && !PlayerSetup.Instance.fullBodyActive)
if(!m_ikCalibrator.avatarCalibratedAsFullBody && (m_vrIk != null) && m_vrIk.enabled && !PlayerSetup.Instance._movementSystem.sitting && (PlayerSetup.Instance._movementSystem.movementVector.magnitude <= Mathf.Epsilon))
{
m_locomotionWeight = Mathf.Lerp(m_locomotionWeight, m_standing ? 1f : 0f, 0.5f);
m_locomotionWeight = Mathf.Lerp(m_locomotionWeight, l_standing ? 1f : 0f, 0.5f);
m_vrIk.solver.locomotion.weight = m_locomotionWeight;
if(l_standing && (m_standing != l_standing))
ms_rootVelocity.SetValue(m_vrIk.solver, Vector3.zero);
}
m_standing = l_standing;
if(m_parameters.Count > 0)
{
foreach(AdditionalParameterInfo l_param in m_parameters)
@ -103,7 +117,7 @@ namespace ml_amt
public void OnSetupAvatarGeneral()
{
m_vrIk = PlayerSetup.Instance._avatar.GetComponent<RootMotion.FinalIK.VRIK>();
m_vrIk = PlayerSetup.Instance._avatar.GetComponent<VRIK>();
// Parse animator parameters
AnimatorControllerParameter[] l_params = PlayerSetup.Instance._animator.parameters;

View file

@ -1,10 +1,10 @@
using System.Reflection;
[assembly: AssemblyTitle("AvatarMotionTweaker")]
[assembly: AssemblyVersion("1.0.5")]
[assembly: AssemblyFileVersion("1.0.5")]
[assembly: AssemblyVersion("1.0.6")]
[assembly: AssemblyFileVersion("1.0.6")]
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.0.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.0.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]

View file

@ -114,7 +114,7 @@ namespace ml_fpt
void StartCalibration()
{
if(m_playerReady && !m_inCalibration && PlayerSetup.Instance._inVr && !PlayerSetup.Instance.fullBodyActive && PlayerSetup.Instance._animator.isHuman && !m_ikCalibrator.inFullbodyCalibration && m_indexIk.calibrated)
if(m_playerReady && !m_inCalibration && PlayerSetup.Instance._inVr && !PlayerSetup.Instance.avatarIsLoading && PlayerSetup.Instance._animator.isHuman && !m_ikCalibrator.inFullbodyCalibration && !m_ikCalibrator.avatarCalibratedAsFullBody && m_indexIk.calibrated)
{
for(int i = 0; i < PlayerSetup.Instance._trackerManager.trackerNames.Length; i++)
{

View file

@ -1,10 +1,10 @@
using System.Reflection;
[assembly: AssemblyTitle("FourPointTracking")]
[assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: AssemblyVersion("1.0.3")]
[assembly: AssemblyFileVersion("1.0.3")]
[assembly: MelonLoader.MelonInfo(typeof(ml_fpt.FourPointTracking), "FourPointTracking", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_fpt.FourPointTracking), "FourPointTracking", "1.0.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]