Skip to content

Commit

Permalink
Grounded for jump
Browse files Browse the repository at this point in the history
  • Loading branch information
SDraw committed Oct 21, 2022
1 parent a2ce54f commit 0a298b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.3 | Yes | Working |
| Avatar Motion Tweaker | ml_amt | 1.1.5 | On review | Working |
| Avatar Motion Tweaker | ml_amt | 1.1.7 | On review | Working |
| Desktop Head Tracking | ml_dht | 1.0.7 | On review | Working |
| Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working |
| Four Point Tracking | ml_fpt | 1.0.9 | On review | Working |
Expand Down
8 changes: 6 additions & 2 deletions ml_amt/MotionTweaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ namespace ml_amt
[DisallowMultipleComponent]
class MotionTweaker : MonoBehaviour
{
static readonly FieldInfo ms_rootVelocity = typeof(IKSolverVR).GetField("rootVelocity", BindingFlags.NonPublic | BindingFlags.Instance);
static readonly FieldInfo ms_grounded = typeof(MovementSystem).GetField("_isGrounded", BindingFlags.NonPublic | BindingFlags.Instance);
static readonly FieldInfo ms_groundedRaw = typeof(MovementSystem).GetField("_isGroundedRaw", BindingFlags.NonPublic | BindingFlags.Instance);
static readonly FieldInfo ms_rootVelocity = typeof(IKSolverVR).GetField("rootVelocity", BindingFlags.NonPublic | BindingFlags.Instance);
static readonly int ms_emoteHash = Animator.StringToHash("Emote");

enum ParameterType
Expand Down Expand Up @@ -54,6 +55,7 @@ enum PoseState
float m_upright = 1f;
PoseState m_poseState = PoseState.Standing;
bool m_grounded = false;
bool m_groundedRaw = false;

bool m_ikOverrideCrouch = true;
float m_crouchLimit = 0.65f;
Expand Down Expand Up @@ -111,7 +113,8 @@ void Update()
{
if(m_avatarReady)
{
m_grounded = (bool)ms_groundedRaw.GetValue(MovementSystem.Instance);
m_grounded = (bool)ms_grounded.GetValue(MovementSystem.Instance);
m_groundedRaw = (bool)ms_groundedRaw.GetValue(MovementSystem.Instance);

// Update upright
Matrix4x4 l_hmdMatrix = PlayerSetup.Instance.transform.GetMatrix().inverse * (PlayerSetup.Instance._inVr ? PlayerSetup.Instance.vrHeadTracker.transform.GetMatrix() : PlayerSetup.Instance.desktopCameraRig.transform.GetMatrix());
Expand Down Expand Up @@ -204,6 +207,7 @@ public void OnAvatarClear()
m_vrIk = null;
m_locomotionLayer = -1;
m_grounded = false;
m_groundedRaw = false;
m_avatarReady = false;
m_compatibleAvatar = false;
m_poseState = PoseState.Standing;
Expand Down
6 changes: 3 additions & 3 deletions ml_amt/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Reflection;

[assembly: AssemblyTitle("AvatarMotionTweaker")]
[assembly: AssemblyVersion("1.1.6")]
[assembly: AssemblyFileVersion("1.1.6")]
[assembly: AssemblyVersion("1.1.7")]
[assembly: AssemblyFileVersion("1.1.7")]

[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.1.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.1.7", "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)]

0 comments on commit 0a298b8

Please sign in to comment.