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
|
@ -56,6 +56,8 @@ namespace ml_amt
|
|||
if(ms_instance == this)
|
||||
ms_instance = null;
|
||||
|
||||
if(m_localTweaker != null)
|
||||
UnityEngine.Object.Destroy(m_localTweaker);
|
||||
m_localTweaker = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,10 @@ namespace ml_amt
|
|||
|
||||
void OnDestroy()
|
||||
{
|
||||
m_vrIk = null;
|
||||
m_ikLimits = null;
|
||||
m_parameters.Clear();
|
||||
|
||||
Settings.CrouchLimitChange -= this.SetCrouchLimit;
|
||||
Settings.ProneLimitChange -= this.SetProneLimit;
|
||||
Settings.IKOverrideFlyChange -= this.SetIKOverrideFly;
|
||||
|
|
|
@ -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;
|
||||
|
@ -327,18 +352,24 @@ namespace ml_lme
|
|||
}
|
||||
}
|
||||
void OnIKPostUpdate()
|
||||
{
|
||||
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
|
||||
void OnEnabledChange(bool p_state)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -79,8 +79,33 @@ namespace ml_pam
|
|||
|
||||
void OnDestroy()
|
||||
{
|
||||
if(m_armIKLeft != null)
|
||||
Destroy(m_armIKLeft);
|
||||
m_armIKLeft = null;
|
||||
|
||||
if(m_armIKRight != null)
|
||||
Destroy(m_armIKRight);
|
||||
m_armIKRight = null;
|
||||
|
||||
if(m_rootLeft != null)
|
||||
Destroy(m_rootLeft);
|
||||
m_rootLeft = null;
|
||||
m_leftTarget = null;
|
||||
|
||||
if(m_rootRight != null)
|
||||
Destroy(m_rootRight);
|
||||
m_rootRight = null;
|
||||
m_rightTarget = null;
|
||||
|
||||
m_pickup = null;
|
||||
m_vrIK = null;
|
||||
m_origLeftHand = null;
|
||||
m_origRightHand = null;
|
||||
|
||||
Settings.EnabledChange -= this.SetEnabled;
|
||||
Settings.GrabOffsetChange -= this.SetGrabOffset;
|
||||
Settings.LeadingHandChange -= this.OnLeadingHandChange;
|
||||
Settings.HandsExtensionChange -= this.OnHandsExtensionChange;
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
|
|
@ -61,6 +61,10 @@ namespace ml_pam
|
|||
{
|
||||
if(ms_instance == this)
|
||||
ms_instance = null;
|
||||
|
||||
if(m_localMover != null)
|
||||
UnityEngine.Object.Destroy(m_localMover);
|
||||
m_localMover = null;
|
||||
}
|
||||
|
||||
static void OnAvatarClear_Postfix() => ms_instance?.OnAvatarClear();
|
||||
|
|
|
@ -42,6 +42,10 @@ namespace ml_pmc
|
|||
if(ms_instance == this)
|
||||
ms_instance = null;
|
||||
|
||||
ModUi.CopySwitch -= this.OnTargetSelect;
|
||||
|
||||
if(m_localCopycat != null)
|
||||
UnityEngine.Object.Destroy(m_localCopycat);
|
||||
m_localCopycat = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,15 +33,26 @@ namespace ml_pmc
|
|||
HumanPose m_pose;
|
||||
PuppetParser m_puppetParser = null;
|
||||
|
||||
internal PoseCopycat()
|
||||
void Start()
|
||||
{
|
||||
if(Instance == null)
|
||||
Instance = this;
|
||||
}
|
||||
~PoseCopycat()
|
||||
void OnDestroy()
|
||||
{
|
||||
if(Instance == this)
|
||||
Instance = null;
|
||||
|
||||
m_poseHandler?.Dispose();
|
||||
m_poseHandler = null;
|
||||
|
||||
if(m_puppetParser != null)
|
||||
Object.Destroy(m_puppetParser);
|
||||
m_puppetParser = null;
|
||||
|
||||
m_animator = null;
|
||||
m_vrIk = null;
|
||||
m_lookAtIk = null;
|
||||
}
|
||||
|
||||
// Unity events
|
||||
|
|
|
@ -89,6 +89,10 @@ namespace ml_prm
|
|||
if(ms_instance == this)
|
||||
ms_instance = null;
|
||||
|
||||
ModUi.SwitchChange -= this.OnSwitchActivation;
|
||||
|
||||
if(m_localController != null)
|
||||
UnityEngine.Object.Destroy(m_localController);
|
||||
m_localController = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ namespace ml_prm
|
|||
Vector3 m_ragdollLastPos = Vector3.zero;
|
||||
|
||||
RagdollToggle m_avatarRagdollToggle = null;
|
||||
RagdollTrigger m_customTrigger = null;
|
||||
RagdollTrigger m_ragdollTrigger = null;
|
||||
AvatarBoolParameter m_ragdolledParameter = null;
|
||||
readonly PhysicMaterial m_physicsMaterial = null;
|
||||
PhysicMaterial m_physicsMaterial = null;
|
||||
|
||||
bool m_reachedGround = true;
|
||||
float m_groundedTime = 0f;
|
||||
|
@ -56,14 +56,20 @@ namespace ml_prm
|
|||
|
||||
internal RagdollController()
|
||||
{
|
||||
if(Instance == null)
|
||||
Instance = this;
|
||||
|
||||
m_rigidBodies = new List<Rigidbody>();
|
||||
m_colliders = new List<Collider>();
|
||||
m_boneLinks = new List<System.Tuple<Transform, Transform>>();
|
||||
m_jointAnchors = new List<System.Tuple<CharacterJoint, Vector3>>();
|
||||
m_physicsInfluencers = new List<PhysicsInfluencer>();
|
||||
}
|
||||
|
||||
// Unity events
|
||||
void Start()
|
||||
{
|
||||
if(Instance == null)
|
||||
Instance = this;
|
||||
|
||||
m_inVr = Utils.IsInVR();
|
||||
|
||||
m_physicsMaterial = new PhysicMaterial("Ragdoll");
|
||||
m_physicsMaterial.dynamicFriction = c_defaultFriction;
|
||||
|
@ -71,25 +77,14 @@ namespace ml_prm
|
|||
m_physicsMaterial.frictionCombine = PhysicMaterialCombine.Average;
|
||||
m_physicsMaterial.bounciness = 0f;
|
||||
m_physicsMaterial.bounceCombine = PhysicMaterialCombine.Average;
|
||||
}
|
||||
~RagdollController()
|
||||
{
|
||||
if(Instance == this)
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
// Unity events
|
||||
void Start()
|
||||
{
|
||||
m_inVr = Utils.IsInVR();
|
||||
|
||||
m_puppetRoot = new GameObject("[PlayerAvatarPuppet]").transform;
|
||||
m_puppetRoot.parent = PlayerSetup.Instance.transform;
|
||||
m_puppetRoot.localPosition = Vector3.zero;
|
||||
m_puppetRoot.localRotation = Quaternion.identity;
|
||||
|
||||
m_customTrigger = MovementSystem.Instance.proxyCollider.gameObject.AddComponent<RagdollTrigger>();
|
||||
m_customTrigger.enabled = false;
|
||||
m_ragdollTrigger = MovementSystem.Instance.proxyCollider.gameObject.AddComponent<RagdollTrigger>();
|
||||
m_ragdollTrigger.enabled = false;
|
||||
|
||||
Settings.MovementDragChange += this.OnMovementDragChange;
|
||||
Settings.AngularDragChange += this.OnAngularDragChange;
|
||||
|
@ -101,17 +96,38 @@ namespace ml_prm
|
|||
|
||||
void OnDestroy()
|
||||
{
|
||||
if(m_customTrigger != null)
|
||||
{
|
||||
Object.Destroy(m_customTrigger);
|
||||
m_customTrigger = null;
|
||||
}
|
||||
if(Instance == this)
|
||||
Instance = null;
|
||||
|
||||
if(m_initCoroutine != null)
|
||||
StopCoroutine(m_initCoroutine);
|
||||
m_initCoroutine = null;
|
||||
|
||||
if(m_puppetRoot != null)
|
||||
Object.Destroy(m_puppetRoot);
|
||||
m_puppetRoot = null;
|
||||
m_puppet = null;
|
||||
m_rigidBodies.Clear();
|
||||
m_colliders.Clear();
|
||||
m_boneLinks.Clear();
|
||||
m_jointAnchors.Clear();
|
||||
m_physicsInfluencers.Clear();
|
||||
m_avatarRagdollToggle = null;
|
||||
|
||||
if(m_ragdollTrigger != null)
|
||||
Object.Destroy(m_ragdollTrigger);
|
||||
m_ragdollTrigger = null;
|
||||
|
||||
if(m_physicsMaterial != null)
|
||||
Object.Destroy(m_physicsMaterial);
|
||||
m_physicsMaterial = null;
|
||||
|
||||
Settings.MovementDragChange -= this.OnMovementDragChange;
|
||||
Settings.AngularDragChange -= this.OnAngularDragChange;
|
||||
Settings.GravityChange -= this.OnGravityChange;
|
||||
Settings.SlipperinessChange -= this.OnPhysicsMaterialChange;
|
||||
Settings.BouncinessChange -= this.OnPhysicsMaterialChange;
|
||||
Settings.BuoyancyChange -= this.OnBuoyancyChange;
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
@ -153,7 +169,7 @@ namespace ml_prm
|
|||
if((m_avatarRagdollToggle != null) && m_avatarRagdollToggle.isActiveAndEnabled && m_avatarRagdollToggle.shouldOverride && (m_enabled != m_avatarRagdollToggle.isOn))
|
||||
SwitchRagdoll();
|
||||
|
||||
if((m_customTrigger != null) && m_customTrigger.GetStateWithReset() && m_avatarReady && !m_enabled && Settings.PointersReaction)
|
||||
if((m_ragdollTrigger != null) && m_ragdollTrigger.GetStateWithReset() && m_avatarReady && !m_enabled && Settings.PointersReaction)
|
||||
SwitchRagdoll();
|
||||
|
||||
if(Settings.Hotkey && Input.GetKeyDown(Settings.HotkeyKey) && !ViewManager.Instance.isGameMenuOpen())
|
||||
|
@ -199,10 +215,10 @@ namespace ml_prm
|
|||
Object.Destroy(m_puppet.gameObject);
|
||||
m_puppet = null;
|
||||
|
||||
if(m_customTrigger != null)
|
||||
if(m_ragdollTrigger != null)
|
||||
{
|
||||
m_customTrigger.GetStateWithReset();
|
||||
m_customTrigger.enabled = false;
|
||||
m_ragdollTrigger.GetStateWithReset();
|
||||
m_ragdollTrigger.enabled = false;
|
||||
}
|
||||
|
||||
m_vrIK = null;
|
||||
|
@ -352,7 +368,7 @@ namespace ml_prm
|
|||
|
||||
m_puppetRoot.gameObject.SetActive(false);
|
||||
|
||||
m_customTrigger.enabled = true;
|
||||
m_ragdollTrigger.enabled = true;
|
||||
m_avatarReady = true;
|
||||
m_initCoroutine = null;
|
||||
|
||||
|
|
|
@ -25,7 +25,12 @@ namespace ml_prm
|
|||
|
||||
void OnDestroy()
|
||||
{
|
||||
if(m_collider != null)
|
||||
CVRParticlePointerManager.RemoveTrigger(m_collider);
|
||||
m_collider = null;
|
||||
|
||||
m_lastColliderTrigger = null;
|
||||
m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue