mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Fingers values reset
Hips transform restore after pose modification
This commit is contained in:
parent
7ef112d02c
commit
0440baa84f
5 changed files with 96 additions and 6 deletions
|
@ -15,6 +15,8 @@ namespace ml_lme
|
|||
bool m_inVR = false;
|
||||
bool m_gripToGrab = true;
|
||||
|
||||
bool m_handVisibleLeft = false;
|
||||
bool m_handVisibleRight = false;
|
||||
ControllerRay m_handRayLeft = null;
|
||||
ControllerRay m_handRayRight = null;
|
||||
LineRenderer m_lineLeft = null;
|
||||
|
@ -121,10 +123,32 @@ namespace ml_lme
|
|||
if(Settings.Enabled)
|
||||
{
|
||||
if(l_data.m_leftHand.m_present)
|
||||
{
|
||||
SetFingersInput(l_data.m_leftHand, true);
|
||||
m_handVisibleLeft = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_handVisibleLeft)
|
||||
{
|
||||
ResetFingers(true);
|
||||
m_handVisibleLeft = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(l_data.m_rightHand.m_present)
|
||||
{
|
||||
SetFingersInput(l_data.m_rightHand, false);
|
||||
m_handVisibleRight = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_handVisibleRight)
|
||||
{
|
||||
ResetFingers(false);
|
||||
m_handVisibleRight = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_inVR)
|
||||
{
|
||||
|
@ -209,6 +233,8 @@ namespace ml_lme
|
|||
{
|
||||
OnInputChange(p_state && Settings.Input);
|
||||
UpdateFingerTracking();
|
||||
m_handVisibleLeft &= p_state;
|
||||
m_handVisibleRight &= p_state;
|
||||
}
|
||||
|
||||
void OnInputChange(bool p_state)
|
||||
|
@ -251,6 +277,12 @@ namespace ml_lme
|
|||
{
|
||||
m_inputManager.individualFingerTracking = (Settings.Enabled || (m_inVR && Utils.AreKnucklesInUse() && !m_steamVrModule.GetIndexGestureToggle()));
|
||||
IKSystem.Instance.FingerSystem.controlActive = m_inputManager.individualFingerTracking;
|
||||
|
||||
if(!Settings.Enabled)
|
||||
{
|
||||
ResetFingers(true);
|
||||
ResetFingers(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SetFingersInput(GestureMatcher.HandData p_hand, bool p_left)
|
||||
|
@ -283,6 +315,36 @@ namespace ml_lme
|
|||
}
|
||||
}
|
||||
|
||||
void ResetFingers(bool p_left)
|
||||
{
|
||||
if(p_left)
|
||||
{
|
||||
m_inputManager.fingerCurlLeftThumb = 0f;
|
||||
m_inputManager.fingerCurlLeftIndex = 0f;
|
||||
m_inputManager.fingerCurlLeftMiddle = 0f;
|
||||
m_inputManager.fingerCurlLeftRing = 0f;
|
||||
m_inputManager.fingerCurlLeftPinky = 0f;
|
||||
IKSystem.Instance.FingerSystem.leftThumbCurl = 0f;
|
||||
IKSystem.Instance.FingerSystem.leftIndexCurl = 0f;
|
||||
IKSystem.Instance.FingerSystem.leftMiddleCurl = 0f;
|
||||
IKSystem.Instance.FingerSystem.leftRingCurl = 0f;
|
||||
IKSystem.Instance.FingerSystem.leftPinkyCurl = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_inputManager.fingerCurlRightThumb = 0f;
|
||||
m_inputManager.fingerCurlRightIndex = 0f;
|
||||
m_inputManager.fingerCurlRightMiddle = 0f;
|
||||
m_inputManager.fingerCurlRightRing = 0f;
|
||||
m_inputManager.fingerCurlRightPinky = 0f;
|
||||
IKSystem.Instance.FingerSystem.rightThumbCurl = 0f;
|
||||
IKSystem.Instance.FingerSystem.rightIndexCurl = 0f;
|
||||
IKSystem.Instance.FingerSystem.rightMiddleCurl = 0f;
|
||||
IKSystem.Instance.FingerSystem.rightRingCurl = 0f;
|
||||
IKSystem.Instance.FingerSystem.rightPinkyCurl = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Game settings
|
||||
void OnGameSettingBoolChange(string p_name, bool p_state)
|
||||
{
|
||||
|
|
|
@ -232,7 +232,14 @@ namespace ml_lme
|
|||
|
||||
if(PlayerSetup.Instance._animator.isHuman)
|
||||
{
|
||||
Vector3 l_hipsPos = Vector3.zero;
|
||||
Quaternion l_hipsRot = Quaternion.identity;
|
||||
m_hips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips);
|
||||
if(m_hips != null)
|
||||
{
|
||||
l_hipsPos = m_hips.localPosition;
|
||||
l_hipsRot = m_hips.localRotation;
|
||||
}
|
||||
|
||||
if(!m_inVR)
|
||||
{
|
||||
|
@ -308,6 +315,12 @@ namespace ml_lme
|
|||
m_vrIK.solver.OnPreUpdate += this.OnIKPreUpdate;
|
||||
m_vrIK.solver.OnPostUpdate += this.OnIKPostUpdate;
|
||||
}
|
||||
|
||||
if(m_hips != null)
|
||||
{
|
||||
m_hips.localPosition = l_hipsPos;
|
||||
m_hips.localRotation = l_hipsRot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("LeapMotionExtension")]
|
||||
[assembly: AssemblyVersion("1.3.4")]
|
||||
[assembly: AssemblyFileVersion("1.3.4")]
|
||||
[assembly: AssemblyVersion("1.3.5")]
|
||||
[assembly: AssemblyFileVersion("1.3.5")]
|
||||
|
||||
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.5", "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)]
|
||||
|
|
|
@ -132,6 +132,15 @@ namespace ml_pam
|
|||
|
||||
if(PlayerSetup.Instance._animator.isHuman)
|
||||
{
|
||||
Vector3 l_hipsPos = Vector3.zero;
|
||||
Quaternion l_hipsRot = Quaternion.identity;
|
||||
Transform l_hips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips);
|
||||
if(l_hips != null)
|
||||
{
|
||||
l_hipsPos = l_hips.localPosition;
|
||||
l_hipsRot = l_hips.localRotation;
|
||||
}
|
||||
|
||||
HumanPose l_currentPose = new HumanPose();
|
||||
HumanPoseHandler l_poseHandler = null;
|
||||
|
||||
|
@ -190,6 +199,12 @@ namespace ml_pam
|
|||
|
||||
l_poseHandler?.SetHumanPose(ref l_currentPose);
|
||||
l_poseHandler?.Dispose();
|
||||
|
||||
if(l_hips != null)
|
||||
{
|
||||
l_hips.localPosition = l_hipsPos;
|
||||
l_hips.localRotation = l_hipsRot;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_enabled)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("PickupArmMovement")]
|
||||
[assembly: AssemblyVersion("1.0.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.3")]
|
||||
[assembly: AssemblyVersion("1.0.4")]
|
||||
[assembly: AssemblyFileVersion("1.0.4")]
|
||||
|
||||
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||
[assembly: MelonLoader.MelonPriority(1)]
|
||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue