using UnityEngine; /// /// Something in the lobby the player can click to look at up close (the tank, the computer). /// Needs a collider on this object: LobbyCamera raycasts against that collider's actual shape to detect /// hover/click, so keep it tight around just the clickable object. The close-up camera frames /// instead, which defaults to the same collider but can be widened separately via /// (e.g. so a click-target stays small while the camera still frames a wider /// group of objects around it, without also enlarging the clickable area itself). /// [RequireComponent(typeof(Collider))] public class ViewTarget : MonoBehaviour { [Tooltip("Shown as a hint when the pointer is over it.")] public string label = "Look closer"; [Tooltip("Extra space around the object in the close-up (1 = tight fit).")] public float padding = 1.15f; [Tooltip("Degrees the close-up camera looks down at the object.")] public float pitch = 3f; bool hasCustomFraming; Vector3 framingCenter, framingSize; /// Bounds the close-up camera frames: the custom framing box if set, otherwise the click collider's own bounds. public Bounds Bounds => hasCustomFraming ? new Bounds(framingCenter, framingSize) : GetComponent().bounds; /// Frame a different (usually larger) box than the click collider itself, e.g. several props grouped together. public void SetFramingBounds(Bounds b) { hasCustomFraming = true; framingCenter = b.center; framingSize = b.size; } }