From e700ead68403b3a1ded34b4c14a9bbdb1fa8eb11 Mon Sep 17 00:00:00 2001 From: soul Date: Fri, 20 Nov 2026 13:13:38 +0100 Subject: [PATCH] Follow camera: FrameFollow is the one writer of Follow, LookAt and distance; distance = FollowCameraDistancePerReach x Contacts.Radius Co-Authored-By: Claude Sonnet 5.5 --- Assets/Scripts/Gameplay/ActionGameManager.cs | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index c4537a84b..6cfff750e 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -556,11 +556,7 @@ public class ActionGameManager : MonoBehaviour { FollowCamera.Follow = x.missile.transform; FollowCamera.LookAt = x.target ? x.target : x.missile.transform; - x.missile.OnKill += () => - { - FollowCamera.LookAt = ZoneRenderer.EntityInstances[CurrentEntity].LookAtPoint; - FollowCamera.Follow = ZoneRenderer.EntityInstances[CurrentEntity].transform; - }; + x.missile.OnKill += () => FrameFollow(CurrentEntity); }); } }); @@ -1089,8 +1085,7 @@ public class ActionGameManager : MonoBehaviour if (EventLog != null) EventLog.LogMessage(HaulFeed.Line(gain, ItemManager), gain.Adrift > 0 ? Color.yellow : Color.white); })); - FollowCamera.LookAt = ZoneRenderer.EntityInstances[CurrentEntity].LookAtPoint; - FollowCamera.Follow = ZoneRenderer.EntityInstances[CurrentEntity].transform; + FrameFollow(CurrentEntity); _articulationGroups = CurrentEntity.Equipment .Where(item => item.Behaviors.Any(x => x.Data is WeaponData && !(x.Data is LauncherData))) .GroupBy(item => ZoneRenderer.EntityInstances[CurrentEntity] @@ -1198,6 +1193,20 @@ public class ActionGameManager : MonoBehaviour _incomingLockIndicator = (incoming, incoming.GetComponent()); } + private CinemachineFramingTransposer _framingTransposer; + + // The one writer of the follow camera's Follow, LookAt and distance for an entity: the distance is + // the hull's reach (from its centre of mass, where Follow sits) times the authored ratio. + private void FrameFollow(Entity entity) + { + var instance = ZoneRenderer.EntityInstances[entity]; + FollowCamera.LookAt = instance.LookAtPoint; + FollowCamera.Follow = instance.transform; + if (_framingTransposer == null) + _framingTransposer = FollowCamera.GetCinemachineComponent(); + _framingTransposer.m_CameraDistance = Settings.FollowCameraDistancePerReach * Contacts.Radius(entity); + } + private void UpdatePlayerPanel() { ShipPanel.Display(CurrentEntity, true);