using UnityEngine; namespace Ashwild.Player { /// /// Snaps a held-item prefab to a fixed local pose inside the hand holder. Added by /// composition next to a behaviour (tool, consumable) or alone on a decorative /// item — it carries no use logic, only how the model sits in the hand. Applied in /// Awake because Instantiate into the holder overrides the prefab's local transform. /// [DisallowMultipleComponent] public class HeldItemOffset : MonoBehaviour { #region Serialized Fields [Header("Local Pose In Hand")] /// /// Local position the model takes once equipped in the holder. /// [SerializeField] private Vector3 positionOffset; /// /// Local euler rotation the model takes once equipped in the holder. /// [SerializeField] private Vector3 rotationOffset; /// /// Local scale the model takes once equipped (defaults to no scaling). /// [SerializeField] private Vector3 scale = Vector3.one; #endregion #region Unity Lifecycle /// /// Forces the authored local pose right after the prefab is spawned in the hand. /// private void Awake() { transform.localPosition = positionOffset; transform.localRotation = Quaternion.Euler(rotationOffset); transform.localScale = scale; } #endregion } }