public static void SetPlayerDynamicBones(bool onState) { if (_playerCharacter == null) { return; } foreach (var dynamicBoneV2 in _playerCharacter.GetComponentsInChildren <DynamicBone_Ver02>(true)) { if (dynamicBoneV2 == null) { continue; } if (dynamicBoneV2.enabled != onState) { dynamicBoneV2.enabled = onState; } } }
private static void SetStateDynamicBones(AIChara.ChaControl character, bool isVisible, VisibilityMask visibilityMask, bool isVisibleInBodyRange = false, bool setIllusionColliders = false) { if (AIMainGameOptimizations._IKSolverChecks.Value) { if (character.fullBodyIK.enabled != isVisible) { character.fullBodyIK.enabled = isVisible; } } if (AIMainGameOptimizations._LookControllerChecks.Value) { if (character.neckLookCtrl.enabled != isVisible) { character.neckLookCtrl.enabled = isVisible; } if (character.eyeLookCtrl.enabled != isVisible) { character.eyeLookCtrl.enabled = isVisible; } } foreach (var dynamicBone in character.GetComponentsInChildren <DynamicBone>(true)) { if (!dynamicBone) { continue; } bool bIsVisibleInRange = isVisible; if (dynamicBone.m_Root != null) { if (dynamicBone.m_Root.name.Contains("V****a")) { bIsVisibleInRange = (visibilityMask & VisibilityMask.VaginaMask) == VisibilityMask.VaginaMask; } else if (dynamicBone.m_Root.name.Contains("hair")) { bIsVisibleInRange = (visibilityMask & VisibilityMask.HairMask) == VisibilityMask.HairMask; } else { bIsVisibleInRange = (visibilityMask & VisibilityMask.ClothingMask) == VisibilityMask.ClothingMask; } } if (dynamicBone.enabled != bIsVisibleInRange) { dynamicBone.enabled = bIsVisibleInRange; } } foreach (var dynamicBoneCollider in character.GetComponentsInChildren <DynamicBoneCollider>(true)) { if (!dynamicBoneCollider) { continue; } if (dynamicBoneCollider.enabled != isVisibleInBodyRange) { dynamicBoneCollider.enabled = isVisibleInBodyRange; } } if (!setIllusionColliders) { return; } foreach (var dynamicBoneV2 in character.GetComponentsInChildren <DynamicBone_Ver02>(true)) { if (!dynamicBoneV2) { continue; } if (dynamicBoneV2.enabled != isVisibleInBodyRange) { dynamicBoneV2.enabled = isVisibleInBodyRange; } } }