diff --git a/src/MotionSource/AbstractFemaleMotionSource.cs b/src/MotionSource/AbstractFemaleMotionSource.cs index 76ac67a..780742d 100644 --- a/src/MotionSource/AbstractFemaleMotionSource.cs +++ b/src/MotionSource/AbstractFemaleMotionSource.cs @@ -244,7 +244,7 @@ private bool UpdateHandTarget(string side) { var carpal = _femaleAtom.GetRigidBodyByName($"{side}Carpal2"); var fingerBase = carpal?.GetComponentByName("_Collider3"); - var fingerTip = _femaleAtom.GetRigidBodyByName($"{side}Pinky3").GetComponentInChildren(); + var fingerTip = _femaleAtom.GetRigidBodyByName($"{side}Pinky3")?.GetComponentInChildren(); if (carpal == null || fingerBase == null || fingerTip == null) return false; @@ -272,9 +272,9 @@ private bool UpdateHandTarget(string side) private bool UpdateChestTarget() { - var left = _femaleAtom.GetComponentByName("AutoColliderFemaleAutoColliderslNipple1").jointCollider as CapsuleCollider; - var right = _femaleAtom.GetComponentByName("AutoColliderFemaleAutoCollidersrNipple1").jointCollider as CapsuleCollider; - var chest = _femaleAtom.GetComponentByName("AutoColliderFemaleAutoColliderschest2c").jointCollider as CapsuleCollider; + var left = _femaleAtom.GetComponentByName("AutoColliderFemaleAutoColliderslNipple1")?.jointCollider as CapsuleCollider; + var right = _femaleAtom.GetComponentByName("AutoColliderFemaleAutoCollidersrNipple1")?.jointCollider as CapsuleCollider; + var chest = _femaleAtom.GetComponentByName("AutoColliderFemaleAutoColliderschest2c")?.jointCollider as CapsuleCollider; if (left == null || right == null || chest == null) return false; @@ -298,10 +298,9 @@ private bool UpdateChestTarget() private bool UpdateFootTarget(string side) { - var foot = _femaleAtom.GetRigidBodyByName($"{side}Foot"); - var footBase = foot?.GetComponentByName("_Collider6"); + var footBase = _femaleAtom.GetRigidBodyByName($"{side}Foot")?.GetComponentByName("_Collider6"); - if (foot == null || footBase == null) + if (footBase == null) return false; _targetRight = footBase.transform.forward; @@ -319,12 +318,10 @@ private bool UpdateFootTarget(string side) private bool UpdateFeetTarget() { - var leftFoot = _femaleAtom.GetRigidBodyByName("lFoot"); - var rightFoot = _femaleAtom.GetRigidBodyByName("rFoot"); - var leftFootBase = leftFoot?.GetComponentByName("_Collider6"); - var rightFootBase = rightFoot?.GetComponentByName("_Collider6"); + var leftFootBase = _femaleAtom.GetRigidBodyByName("lFoot")?.GetComponentByName("_Collider6"); + var rightFootBase = _femaleAtom.GetRigidBodyByName("rFoot")?.GetComponentByName("_Collider6"); - if (leftFoot == null || rightFoot == null || leftFootBase == null || rightFootBase == null) + if (leftFootBase == null || rightFootBase == null) return false; var leftPosition = leftFootBase.transform.position - leftFootBase.transform.up * leftFootBase.radius;