Skip to content

Commit

Permalink
Fixed bug with scopes not working due to collider parent moving
Browse files Browse the repository at this point in the history
  • Loading branch information
cybensis committed Dec 8, 2024
1 parent 108edc7 commit 18a07f5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Patches/Core/Player/WeaponPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ private static void SetOpticCamFoV(EFT.CameraControl.OpticComponentUpdater __ins
VRGlobals.vrPlayer.scopeUiPosition = __instance.transform_0.FindChild("backLens");
opticSight.gameObject.layer = 6;
scopeCollider = opticSight.GetComponent<BoxCollider>();
if (!scopeCollider)
scopeCollider = opticSight.transform.parent.GetComponent<BoxCollider>();
}
if (scopeCollider)
{
Expand All @@ -736,11 +738,16 @@ private static void SetOpticCamFoV(EFT.CameraControl.OpticComponentUpdater __ins
VRGlobals.vrOpticController.currentFov = fov;
}

if (opticSight.name.Contains("mode_"))
opticSight.transform.parent.GetComponent<BoxCollider>().enabled = true;
else
if (opticSight.name.Contains("mode_")) {
if (opticSight.transform.parent.GetComponent<BoxCollider>())
opticSight.transform.parent.GetComponent<BoxCollider>().enabled = true;
else if (opticSight.transform.parent.parent.GetComponent<BoxCollider>())
opticSight.transform.parent.parent.GetComponent<BoxCollider>().enabled = true;
}
else if (opticSight.GetComponent<BoxCollider>())
opticSight.GetComponent<BoxCollider>().enabled = true;

else if (opticSight.transform.parent.GetComponent<BoxCollider>())
opticSight.transform.parent.GetComponent<BoxCollider>().enabled = true;


}
Expand Down

0 comments on commit 18a07f5

Please sign in to comment.