Skip to content

Commit

Permalink
Constrain camera and fix HighlightingRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBigz committed Nov 7, 2024
1 parent 2fb3295 commit 799779b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions TABGVR/Patches/CameraPatch.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -46,6 +48,26 @@ public static void Postfix(PlayerCamera __instance)
postProcessing.volumeTrigger = gameObject.transform;
postProcessing.volumeLayer = LayerMask.NameToLayer("Post");
postProcessing.m_Resources = __instance.GetComponent<PostProcessLayer>().m_Resources;

var highlight = gameObject.AddComponent<HighlightingRenderer>();
var highlightReference = __instance.GetComponent<HighlightingRenderer>();
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<RotationConstraint>();
constraint.AddSource(source);

constraint.constraintActive = true;

// var playerDriver = playerManager.playerRoot.AddComponent<PlayerDriver>();
// playerDriver.trackingType = TrackedPoseDriver.TrackingType.RotationOnly;
Expand Down

0 comments on commit 799779b

Please sign in to comment.