mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Transformation fixes
More checks for non-flying worlds
This commit is contained in:
parent
9159946de6
commit
732b15a6a9
9 changed files with 43 additions and 35 deletions
10
README.md
10
README.md
|
@ -4,13 +4,13 @@ Merged set of MelonLoader mods for ChilloutVR.
|
||||||
| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | Notes |
|
| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | Notes |
|
||||||
|:---------:|:----------:|:--------------:| :----------------------------------------------------------------|-------|
|
|:---------:|:----------:|:--------------:| :----------------------------------------------------------------|-------|
|
||||||
| Avatar Change Info | ml_aci | 1.0.3 | ✔ Yes<br>⭕ **Retired** | Superseded by `Extended Game Notifications`
|
| Avatar Change Info | ml_aci | 1.0.3 | ✔ Yes<br>⭕ **Retired** | Superseded by `Extended Game Notifications`
|
||||||
| Avatar Motion Tweaker | ml_amt | 1.2.8 | ✔ Yes<br>⏱ Update review |
|
| Avatar Motion Tweaker | ml_amt | 1.2.8 | ✔ Yes |
|
||||||
| Desktop Head Tracking | ml_dht | 1.1.3 | ✔ Yes |
|
| Desktop Head Tracking | ml_dht | 1.1.3 | ✔ Yes |
|
||||||
| Desktop Reticle Switch | ml_drs | 1.0.0 | ✔ Yes |
|
| Desktop Reticle Switch | ml_drs | 1.0.0 | ✔ Yes |
|
||||||
| Extended Game Notifications | ml_egn | 1.0.2 | ✔ Yes |
|
| Extended Game Notifications | ml_egn | 1.0.2 | ✔ Yes |
|
||||||
| Four Point Tracking | ml_fpt | 1.0.9 | ✔ Yes<br>⭕ **Retired** | In-game feature since 2022r170 update
|
| Four Point Tracking | ml_fpt | 1.0.9 | ✔ Yes<br>⭕ **Retired** | In-game feature since 2022r170 update
|
||||||
| Leap Motion Extension | ml_lme | 1.3.6 | ✔ Yes |
|
| Leap Motion Extension | ml_lme | 1.3.7 | ✔ Yes<br>⏱ Update review |
|
||||||
| Pickup Arm Movement | ml_pam | 1.0.4 | ✔ Yes |
|
| Pickup Arm Movement | ml_pam | 1.0.5 | ✔ Yes<br>⏱ Update review |
|
||||||
| Player Movement Copycat | ml_pmc | 1.0.0 | ⏱ On review |
|
| Player Movement Copycat | ml_pmc | 1.0.0 | ✔ Yes |
|
||||||
| Player Ragdoll Mod | ml_prm | 1.0.4 | ✔ Yes<br>⏱ Update review |
|
| Player Ragdoll Mod | ml_prm | 1.0.5 | ✔ Yes<br>⏱ Update review |
|
||||||
| Server Connection Info | ml_sci | 1.0.2 | ✔ Yes<br>⭕ **Retired** | Superseded by `Extended Game Notifications`
|
| Server Connection Info | ml_sci | 1.0.2 | ✔ Yes<br>⭕ **Retired** | Superseded by `Extended Game Notifications`
|
||||||
|
|
|
@ -233,13 +233,9 @@ namespace ml_lme
|
||||||
if(PlayerSetup.Instance._animator.isHuman)
|
if(PlayerSetup.Instance._animator.isHuman)
|
||||||
{
|
{
|
||||||
Vector3 l_hipsPos = Vector3.zero;
|
Vector3 l_hipsPos = Vector3.zero;
|
||||||
Quaternion l_hipsRot = Quaternion.identity;
|
|
||||||
m_hips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips);
|
m_hips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips);
|
||||||
if(m_hips != null)
|
if(m_hips != null)
|
||||||
{
|
|
||||||
l_hipsPos = m_hips.localPosition;
|
l_hipsPos = m_hips.localPosition;
|
||||||
l_hipsRot = m_hips.localRotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!m_inVR)
|
if(!m_inVR)
|
||||||
{
|
{
|
||||||
|
@ -317,10 +313,7 @@ namespace ml_lme
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_hips != null)
|
if(m_hips != null)
|
||||||
{
|
|
||||||
m_hips.localPosition = l_hipsPos;
|
m_hips.localPosition = l_hipsPos;
|
||||||
m_hips.localRotation = l_hipsRot;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyTitle("LeapMotionExtension")]
|
[assembly: AssemblyTitle("LeapMotionExtension")]
|
||||||
[assembly: AssemblyVersion("1.3.6")]
|
[assembly: AssemblyVersion("1.3.7")]
|
||||||
[assembly: AssemblyFileVersion("1.3.6")]
|
[assembly: AssemblyFileVersion("1.3.7")]
|
||||||
|
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.7", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonOptionalDependencies("ml_pmc")]
|
[assembly: MelonLoader.MelonOptionalDependencies("ml_pmc")]
|
||||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
|
|
|
@ -133,13 +133,9 @@ namespace ml_pam
|
||||||
if(PlayerSetup.Instance._animator.isHuman)
|
if(PlayerSetup.Instance._animator.isHuman)
|
||||||
{
|
{
|
||||||
Vector3 l_hipsPos = Vector3.zero;
|
Vector3 l_hipsPos = Vector3.zero;
|
||||||
Quaternion l_hipsRot = Quaternion.identity;
|
|
||||||
Transform l_hips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips);
|
Transform l_hips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips);
|
||||||
if(l_hips != null)
|
if(l_hips != null)
|
||||||
{
|
|
||||||
l_hipsPos = l_hips.localPosition;
|
l_hipsPos = l_hips.localPosition;
|
||||||
l_hipsRot = l_hips.localRotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
HumanPose l_currentPose = new HumanPose();
|
HumanPose l_currentPose = new HumanPose();
|
||||||
HumanPoseHandler l_poseHandler = null;
|
HumanPoseHandler l_poseHandler = null;
|
||||||
|
@ -201,10 +197,7 @@ namespace ml_pam
|
||||||
l_poseHandler?.Dispose();
|
l_poseHandler?.Dispose();
|
||||||
|
|
||||||
if(l_hips != null)
|
if(l_hips != null)
|
||||||
{
|
|
||||||
l_hips.localPosition = l_hipsPos;
|
l_hips.localPosition = l_hipsPos;
|
||||||
l_hips.localRotation = l_hipsRot;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_enabled)
|
if(m_enabled)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyTitle("PickupArmMovement")]
|
[assembly: AssemblyTitle("PickupArmMovement")]
|
||||||
[assembly: AssemblyVersion("1.0.4")]
|
[assembly: AssemblyVersion("1.0.5")]
|
||||||
[assembly: AssemblyFileVersion("1.0.4")]
|
[assembly: AssemblyFileVersion("1.0.5")]
|
||||||
|
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonPriority(1)]
|
[assembly: MelonLoader.MelonPriority(1)]
|
||||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
|
|
|
@ -130,10 +130,10 @@ namespace ml_prm
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (m_localController != null)
|
if(m_localController != null)
|
||||||
m_localController.OnAvatarScaling(1f + p_scaleDifference);
|
m_localController.OnAvatarScaling(1f + p_scaleDifference);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
MelonLoader.MelonLogger.Error(e);
|
MelonLoader.MelonLogger.Error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyTitle("PlayerRagdollMod")]
|
[assembly: AssemblyTitle("PlayerRagdollMod")]
|
||||||
[assembly: AssemblyVersion("1.0.4")]
|
[assembly: AssemblyVersion("1.0.5")]
|
||||||
[assembly: AssemblyFileVersion("1.0.4")]
|
[assembly: AssemblyFileVersion("1.0.5")]
|
||||||
|
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.0.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.0.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonPriority(2)]
|
[assembly: MelonLoader.MelonPriority(2)]
|
||||||
[assembly: MelonLoader.MelonOptionalDependencies("BTKUILib")]
|
[assembly: MelonLoader.MelonOptionalDependencies("BTKUILib")]
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace ml_prm
|
||||||
readonly PhysicMaterial m_physicsMaterial = null;
|
readonly PhysicMaterial m_physicsMaterial = null;
|
||||||
|
|
||||||
bool m_reachedGround = true;
|
bool m_reachedGround = true;
|
||||||
|
float m_groundedTime = 0f;
|
||||||
float m_downTime = float.MinValue;
|
float m_downTime = float.MinValue;
|
||||||
|
|
||||||
internal RagdollController()
|
internal RagdollController()
|
||||||
|
@ -115,10 +116,14 @@ namespace ml_prm
|
||||||
Vector3 l_pos = PlayerSetup.Instance.transform.position;
|
Vector3 l_pos = PlayerSetup.Instance.transform.position;
|
||||||
m_velocity = (m_velocity + (l_pos - m_lastPosition) / Time.deltaTime) * 0.5f;
|
m_velocity = (m_velocity + (l_pos - m_lastPosition) / Time.deltaTime) * 0.5f;
|
||||||
m_lastPosition = l_pos;
|
m_lastPosition = l_pos;
|
||||||
}
|
|
||||||
|
|
||||||
if(m_avatarReady && !m_reachedGround)
|
if(!m_reachedGround && MovementSystem.Instance.IsGrounded())
|
||||||
m_reachedGround = MovementSystem.Instance.IsGrounded();
|
{
|
||||||
|
m_groundedTime += Time.deltaTime;
|
||||||
|
if(m_groundedTime >= 0.25f)
|
||||||
|
m_reachedGround = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(m_avatarReady && m_enabled && !BodySystem.isCalibrating)
|
if(m_avatarReady && m_enabled && !BodySystem.isCalibrating)
|
||||||
BodySystem.TrackingPositionWeight = 0f;
|
BodySystem.TrackingPositionWeight = 0f;
|
||||||
|
@ -189,6 +194,7 @@ namespace ml_prm
|
||||||
m_boneLinks.Clear();
|
m_boneLinks.Clear();
|
||||||
m_jointAnchors.Clear();
|
m_jointAnchors.Clear();
|
||||||
m_reachedGround = true;
|
m_reachedGround = true;
|
||||||
|
m_groundedTime = 0f;
|
||||||
m_downTime = float.MinValue;
|
m_downTime = float.MinValue;
|
||||||
m_puppetRoot.localScale = Vector3.one;
|
m_puppetRoot.localScale = Vector3.one;
|
||||||
}
|
}
|
||||||
|
@ -335,7 +341,10 @@ namespace ml_prm
|
||||||
internal void OnCombatDown()
|
internal void OnCombatDown()
|
||||||
{
|
{
|
||||||
if(m_avatarReady && !m_enabled && Settings.CombatReaction)
|
if(m_avatarReady && !m_enabled && Settings.CombatReaction)
|
||||||
|
{
|
||||||
|
m_reachedGround = true;
|
||||||
SwitchRagdoll();
|
SwitchRagdoll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnToggleFlight()
|
internal void OnToggleFlight()
|
||||||
|
@ -451,7 +460,10 @@ namespace ml_prm
|
||||||
BodySystem.TrackingPositionWeight = 0f;
|
BodySystem.TrackingPositionWeight = 0f;
|
||||||
|
|
||||||
if(!Utils.IsWorldSafe())
|
if(!Utils.IsWorldSafe())
|
||||||
|
{
|
||||||
m_reachedGround = false; // Force player to unragdoll and reach ground first
|
m_reachedGround = false; // Force player to unragdoll and reach ground first
|
||||||
|
m_groundedTime = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
m_puppetRoot.gameObject.SetActive(true);
|
m_puppetRoot.gameObject.SetActive(true);
|
||||||
|
|
||||||
|
@ -485,6 +497,13 @@ namespace ml_prm
|
||||||
if(IsSafeToUnragdoll())
|
if(IsSafeToUnragdoll())
|
||||||
{
|
{
|
||||||
MovementSystem.Instance.SetImmobilized(false);
|
MovementSystem.Instance.SetImmobilized(false);
|
||||||
|
if(!Utils.IsWorldSafe())
|
||||||
|
{
|
||||||
|
Vector3 l_vec = MovementSystem.Instance.GetAppliedGravity();
|
||||||
|
l_vec.y = Mathf.Clamp(l_vec.y, float.MinValue, 0f);
|
||||||
|
MovementSystem.Instance.SetAppliedGravity(l_vec);
|
||||||
|
}
|
||||||
|
|
||||||
m_ragdolledParameter.SetValue(false);
|
m_ragdolledParameter.SetValue(false);
|
||||||
if(!BodySystem.isCalibrating)
|
if(!BodySystem.isCalibrating)
|
||||||
BodySystem.TrackingPositionWeight = 1f;
|
BodySystem.TrackingPositionWeight = 1f;
|
||||||
|
|
|
@ -8,7 +8,8 @@ namespace ml_prm
|
||||||
{
|
{
|
||||||
static class Utils
|
static class Utils
|
||||||
{
|
{
|
||||||
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_appliedGravity = typeof(MovementSystem).GetField("_appliedGravity", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
|
||||||
public static bool IsInVR() => ((CheckVR.Instance != null) && CheckVR.Instance.hasVrDeviceLoaded);
|
public static bool IsInVR() => ((CheckVR.Instance != null) && CheckVR.Instance.hasVrDeviceLoaded);
|
||||||
public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying);
|
public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying);
|
||||||
|
@ -25,7 +26,9 @@ namespace ml_prm
|
||||||
return l_result;
|
return l_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsGrounded(this MovementSystem p_instance) => (bool)ms_grounded.GetValue(p_instance);
|
public static bool IsGrounded(this MovementSystem p_instance) => (bool)ms_groundedRaw.GetValue(p_instance);
|
||||||
|
public static Vector3 GetAppliedGravity(this MovementSystem p_instance) => (Vector3)ms_appliedGravity.GetValue(p_instance);
|
||||||
|
public static void SetAppliedGravity(this MovementSystem p_instance, Vector3 p_vec) => ms_appliedGravity.SetValue(p_instance, p_vec);
|
||||||
|
|
||||||
public static void CopyGlobal(this Transform p_source, Transform p_target)
|
public static void CopyGlobal(this Transform p_source, Transform p_target)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue