From 799779b679b058d5551e17079b89a86f04680939 Mon Sep 17 00:00:00 2001 From: RedBigz Date: Fri, 8 Nov 2024 07:41:38 +1000 Subject: [PATCH] Constrain camera and fix HighlightingRenderer --- TABGVR/Patches/CameraPatch.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/TABGVR/Patches/CameraPatch.cs b/TABGVR/Patches/CameraPatch.cs index 1ea2892..ccd9d3a 100644 --- a/TABGVR/Patches/CameraPatch.cs +++ b/TABGVR/Patches/CameraPatch.cs @@ -1,7 +1,9 @@ using DeepSky.Haze; using HarmonyLib; +using HighlightingSystem; using TABGVR.Player; using UnityEngine; +using UnityEngine.Animations; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SpatialTracking; @@ -46,6 +48,26 @@ public static void Postfix(PlayerCamera __instance) postProcessing.volumeTrigger = gameObject.transform; postProcessing.volumeLayer = LayerMask.NameToLayer("Post"); postProcessing.m_Resources = __instance.GetComponent().m_Resources; + + var highlight = gameObject.AddComponent(); + var highlightReference = __instance.GetComponent(); + highlight.downsampleFactor = highlightReference.downsampleFactor; + highlight.iterations = highlightReference.iterations; + highlight.blurMinSpread = highlightReference.blurMinSpread; + highlight.blurSpread = highlightReference.blurSpread; + highlight.blurIntensity = highlightReference.blurIntensity; + + // constrain the camera + ConstraintSource source = new() + { + sourceTransform = gameObject.transform, + weight = 1f + }; + + var constraint = __instance.gameObject.AddComponent(); + constraint.AddSource(source); + + constraint.constraintActive = true; // var playerDriver = playerManager.playerRoot.AddComponent(); // playerDriver.trackingType = TrackedPoseDriver.TrackingType.RotationOnly;