mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Minor fixes
This commit is contained in:
parent
aebf6c2c4e
commit
914bca26e4
14 changed files with 226 additions and 54 deletions
|
@ -24,16 +24,6 @@ namespace ml_lme
|
|||
bool m_gripLeft = false;
|
||||
bool m_gripRight = false;
|
||||
|
||||
~LeapInput()
|
||||
{
|
||||
Settings.EnabledChange -= this.OnEnableChange;
|
||||
Settings.InteractionChange -= this.OnInteractionChange;
|
||||
Settings.GesturesChange -= this.OnGesturesChange;
|
||||
Settings.FingersOnlyChange -= this.OnFingersOnlyChange;
|
||||
|
||||
MetaPort.Instance.settings.settingBoolChanged.RemoveListener(this.OnGameSettingBoolChange);
|
||||
}
|
||||
|
||||
public override void ModuleAdded()
|
||||
{
|
||||
base.ModuleAdded();
|
||||
|
@ -122,6 +112,34 @@ namespace ml_lme
|
|||
m_lineRight.gameObject.layer = PlayerSetup.Instance.vrRayLeft.gameObject.layer;
|
||||
}
|
||||
|
||||
public override void ModuleDestroyed()
|
||||
{
|
||||
base.ModuleDestroyed();
|
||||
|
||||
if(m_handRayLeft != null)
|
||||
Object.Destroy(m_handRayLeft);
|
||||
m_handRayLeft = null;
|
||||
|
||||
if(m_handRayRight != null)
|
||||
Object.Destroy(m_handRayRight);
|
||||
m_handRayRight = null;
|
||||
|
||||
if(m_lineLeft != null)
|
||||
Object.Destroy(m_lineLeft);
|
||||
m_lineLeft = null;
|
||||
|
||||
if(m_lineRight != null)
|
||||
Object.Destroy(m_lineRight);
|
||||
m_lineRight = null;
|
||||
|
||||
Settings.EnabledChange -= this.OnEnableChange;
|
||||
Settings.InteractionChange -= this.OnInteractionChange;
|
||||
Settings.GesturesChange -= this.OnGesturesChange;
|
||||
Settings.FingersOnlyChange -= this.OnFingersOnlyChange;
|
||||
|
||||
MetaPort.Instance.settings.settingBoolChanged.RemoveListener(this.OnGameSettingBoolChange);
|
||||
}
|
||||
|
||||
public override void UpdateInput()
|
||||
{
|
||||
if(base.InputEnabled)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
@ -60,6 +59,23 @@ namespace ml_lme
|
|||
m_leapController.Dispose();
|
||||
m_leapController = null;
|
||||
|
||||
if(m_leapTracking != null)
|
||||
Object.Destroy(m_leapTracking);
|
||||
m_leapTracking = null;
|
||||
|
||||
if(m_leapTracked != null)
|
||||
Object.Destroy(m_leapTracked);
|
||||
m_leapTracked = null;
|
||||
|
||||
if(m_leapInput != null)
|
||||
{
|
||||
if(CVRInputManager.Instance != null)
|
||||
CVRInputManager.Instance.DestroyInputModule(m_leapInput);
|
||||
else
|
||||
m_leapInput.ModuleDestroyed();
|
||||
}
|
||||
m_leapInput = null;
|
||||
|
||||
Settings.EnabledChange -= this.OnEnableChange;
|
||||
Settings.TrackingModeChange -= this.OnTrackingModeChange;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace ml_lme
|
|||
static readonly Quaternion ms_offsetRight = Quaternion.Euler(0f, 270f, 0f);
|
||||
|
||||
VRIK m_vrIK = null;
|
||||
Vector4 m_vrIKWeights = Vector2.zero;
|
||||
Vector4 m_vrIKWeights = Vector4.zero;
|
||||
bool m_inVR = false;
|
||||
Transform m_hips = null;
|
||||
Transform m_origLeftHand = null;
|
||||
|
@ -61,6 +61,31 @@ namespace ml_lme
|
|||
|
||||
void OnDestroy()
|
||||
{
|
||||
if(m_leftArmIK != null)
|
||||
Destroy(m_leftArmIK);
|
||||
m_leftArmIK = null;
|
||||
|
||||
if(m_rightArmIK != null)
|
||||
Destroy(m_rightArmIK);
|
||||
m_rightArmIK = null;
|
||||
|
||||
if(m_leftHandTarget != null)
|
||||
Destroy(m_leftHandTarget);
|
||||
m_leftHandTarget = null;
|
||||
|
||||
if(m_rightHandTarget != null)
|
||||
Destroy(m_rightHandTarget);
|
||||
m_rightHandTarget = null;
|
||||
|
||||
m_poseHandler?.Dispose();
|
||||
m_poseHandler = null;
|
||||
|
||||
m_vrIK = null;
|
||||
m_origLeftHand = null;
|
||||
m_origRightHand = null;
|
||||
m_origLeftElbow = null;
|
||||
m_origRightElbow = null;
|
||||
|
||||
Settings.EnabledChange -= this.OnEnabledChange;
|
||||
Settings.FingersOnlyChange -= this.OnFingersOnlyChange;
|
||||
Settings.TrackElbowsChange -= this.OnTrackElbowsChange;
|
||||
|
@ -180,7 +205,7 @@ namespace ml_lme
|
|||
m_origLeftElbow = null;
|
||||
m_origRightElbow = null;
|
||||
m_hips = null;
|
||||
m_vrIKWeights = Vector2.zero;
|
||||
m_vrIKWeights = Vector4.zero;
|
||||
m_leftArmIK = null;
|
||||
m_rightArmIK = null;
|
||||
m_leftTargetActive = false;
|
||||
|
@ -328,16 +353,22 @@ namespace ml_lme
|
|||
}
|
||||
void OnIKPostUpdate()
|
||||
{
|
||||
m_vrIK.solver.leftArm.positionWeight = m_vrIKWeights.x;
|
||||
m_vrIK.solver.leftArm.rotationWeight = m_vrIKWeights.y;
|
||||
m_vrIK.solver.leftArm.target = m_origLeftHand;
|
||||
m_vrIK.solver.leftArm.bendGoal = m_origLeftElbow;
|
||||
m_vrIK.solver.leftArm.bendGoalWeight = ((m_origLeftElbow != null) ? 1f : 0f);
|
||||
m_vrIK.solver.rightArm.positionWeight = m_vrIKWeights.z;
|
||||
m_vrIK.solver.rightArm.rotationWeight = m_vrIKWeights.w;
|
||||
m_vrIK.solver.rightArm.target = m_origRightHand;
|
||||
m_vrIK.solver.rightArm.bendGoal = m_origRightElbow;
|
||||
m_vrIK.solver.rightArm.bendGoalWeight = ((m_origRightElbow != null) ? 1f : 0f);
|
||||
if(m_leftTargetActive)
|
||||
{
|
||||
m_vrIK.solver.leftArm.positionWeight = m_vrIKWeights.x;
|
||||
m_vrIK.solver.leftArm.rotationWeight = m_vrIKWeights.y;
|
||||
m_vrIK.solver.leftArm.target = m_origLeftHand;
|
||||
m_vrIK.solver.leftArm.bendGoal = m_origLeftElbow;
|
||||
m_vrIK.solver.leftArm.bendGoalWeight = ((m_origLeftElbow != null) ? 1f : 0f);
|
||||
}
|
||||
if(m_rightTargetActive)
|
||||
{
|
||||
m_vrIK.solver.rightArm.positionWeight = m_vrIKWeights.z;
|
||||
m_vrIK.solver.rightArm.rotationWeight = m_vrIKWeights.w;
|
||||
m_vrIK.solver.rightArm.target = m_origRightHand;
|
||||
m_vrIK.solver.rightArm.bendGoal = m_origRightElbow;
|
||||
m_vrIK.solver.rightArm.bendGoalWeight = ((m_origRightElbow != null) ? 1f : 0f);
|
||||
}
|
||||
}
|
||||
|
||||
// Settings
|
||||
|
|
|
@ -102,8 +102,36 @@ namespace ml_lme
|
|||
if(Instance == this)
|
||||
Instance = null;
|
||||
|
||||
if(m_leapHandLeft != null)
|
||||
Object.Destroy(m_leapHandLeft);
|
||||
m_leapHandLeft = null;
|
||||
|
||||
if(m_leapHandRight != null)
|
||||
Object.Destroy(m_leapHandRight);
|
||||
m_leapHandRight = null;
|
||||
|
||||
if(m_leapElbowLeft != null)
|
||||
Object.Destroy(m_leapElbowLeft);
|
||||
m_leapElbowLeft = null;
|
||||
|
||||
if(m_leapElbowRight != null)
|
||||
Object.Destroy(m_leapElbowRight);
|
||||
m_leapElbowRight = null;
|
||||
|
||||
if(m_leapControllerModel != null)
|
||||
Object.Destroy(m_leapControllerModel);
|
||||
m_leapControllerModel = null;
|
||||
|
||||
if(m_visualHands != null)
|
||||
Object.Destroy(m_visualHands);
|
||||
m_visualHands = null;
|
||||
|
||||
m_visualHandLeft = null;
|
||||
m_visualHandRight = null;
|
||||
|
||||
Settings.DesktopOffsetChange -= this.OnDesktopOffsetChange;
|
||||
Settings.ModelVisibilityChange -= this.OnModelVisibilityChange;
|
||||
Settings.VisualHandsChange -= this.OnVisualHandsChange;
|
||||
Settings.TrackingModeChange -= this.OnTrackingModeChange;
|
||||
Settings.RootAngleChange -= this.OnRootAngleChange;
|
||||
Settings.HeadAttachChange -= this.OnHeadAttachChange;
|
||||
|
|
|
@ -57,6 +57,10 @@ namespace ml_lme
|
|||
{
|
||||
if(ms_instance == this)
|
||||
ms_instance = null;
|
||||
|
||||
if(m_leapManager != null)
|
||||
Object.Destroy(m_leapManager);
|
||||
m_leapManager = null;
|
||||
}
|
||||
|
||||
IEnumerator WaitForRootLogic()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue