diff --git a/TABGVR/Patches/CameraPatch.cs b/TABGVR/Patches/CameraPatch.cs index 99ff0db..1ea2892 100644 --- a/TABGVR/Patches/CameraPatch.cs +++ b/TABGVR/Patches/CameraPatch.cs @@ -1,6 +1,8 @@ +using DeepSky.Haze; using HarmonyLib; using TABGVR.Player; using UnityEngine; +using UnityEngine.Rendering.PostProcessing; using UnityEngine.SpatialTracking; namespace TABGVR.Patches; @@ -11,14 +13,14 @@ public class CameraPatch public static void Postfix(PlayerCamera __instance) { Plugin.Logger.LogInfo($"Camera idle: {__instance.gameObject.name}"); - - var playerManager = PlayerManager.FromCamera(__instance.GetComponent()); + + var playerManager = PlayerManager.FromCamera(__instance.cam); var gameObject = new GameObject("VRCamera") { transform = { - parent = __instance.transform.parent.parent.parent.parent.parent.parent.parent, + parent = playerManager.playerRoot.transform.Find("CameraMovement"), position = __instance.transform.position, }, tag = "MainCamera", @@ -36,11 +38,17 @@ public static void Postfix(PlayerCamera __instance) var driver = gameObject.AddComponent(); driver.trackingType = TrackedPoseDriver.TrackingType.RotationOnly; driver.poseSource = TrackedPoseDriver.TrackedPose.Head; - + + gameObject.AddComponent(); + gameObject.AddComponent(); + + var postProcessing = gameObject.AddComponent(); + postProcessing.volumeTrigger = gameObject.transform; + postProcessing.volumeLayer = LayerMask.NameToLayer("Post"); + postProcessing.m_Resources = __instance.GetComponent().m_Resources; + // var playerDriver = playerManager.playerRoot.AddComponent(); // playerDriver.trackingType = TrackedPoseDriver.TrackingType.RotationOnly; // playerDriver.poseSource = TrackedPoseDriver.TrackedPose.Head; - - // Object.Destroy(gameObject.GetComponent()); } } \ No newline at end of file diff --git a/TABGVR/TABGVR.csproj b/TABGVR/TABGVR.csproj index 2808350..0ffb41c 100644 --- a/TABGVR/TABGVR.csproj +++ b/TABGVR/TABGVR.csproj @@ -36,6 +36,7 @@ +