diff --git a/LCVR/EntryPoint.cs b/LCVR/EntryPoint.cs index 487ee536..38bb3f7b 100644 --- a/LCVR/EntryPoint.cs +++ b/LCVR/EntryPoint.cs @@ -59,6 +59,16 @@ private static IEnumerator Start() // Toggle helmet visor visibility helmetModel.SetActive(Plugin.Config.EnableHelmetVisor.Value); + // Move helmet model to child of target point + var helmetTarget = StartOfRound.Instance.localPlayerController.gameObject.Find("ScavengerModel/metarig/CameraContainer/MainCamera/HUDHelmetPosition").transform; + helmetContainer.transform.SetParent(helmetTarget, false); + + helmetContainer.transform.localPosition = Vector3.zero; + helmetContainer.transform.localEulerAngles = Vector3.zero; + + helmetTarget.transform.localPosition = new Vector3(0.01f, -0.068f, -0.073f); + helmetTarget.transform.localScale = Vector3.one; + // Disable ui camera and promote main camera mainCamera.targetTexture = null; uiCamera.GetComponent().xrRendering = false; diff --git a/Patches/PlayerControllerPatches.cs b/Patches/PlayerControllerPatches.cs index e5d08d90..b7e4ccf3 100644 --- a/Patches/PlayerControllerPatches.cs +++ b/Patches/PlayerControllerPatches.cs @@ -93,6 +93,16 @@ static IEnumerable Transpiler(IEnumerable inst codes[index + 2].operand = 0.025f; codes[index + 5].operand = 0.025f; + // Remove local visor updating (this will be done using hierarchy instead) + var startIndex = codes.FindIndex(x => x.opcode == OpCodes.Ldfld && x.operand == (object)Field(typeof(PlayerControllerB), nameof(PlayerControllerB.localVisor))) - 1; + var endIndex = startIndex + 21; + + for (int i = startIndex; i <= endIndex; i++) + { + codes[i].opcode = OpCodes.Nop; + codes[i].operand = null; + } + return codes.AsEnumerable(); } }