using UnityEngine; namespace Streamingle.Utils.RoughConstraints { [ExecuteAlways] [AddComponentMenu("Streamingle Utilities/Constraints/Rough Scale Constraint")] public class RoughScaleConstraint : RoughConstraintBase { [Header("Scale")] public Vector3Bool constrainedAxis = Vector3Bool.All; public Vector3 scaleOffset; protected override void ExecuteConstraint(float followT) { if (!TryGetWeightedScale(out var targetScale)) { return; } targetScale += scaleOffset; targetScale = ApplyAxisMask(transform.localScale, targetScale, constrainedAxis); transform.localScale = Vector3.Lerp(transform.localScale, targetScale, followT * weight); } protected override void CaptureOffsetsFromCurrentPose() { if (!TryGetWeightedScale(out var sourceScale)) { return; } scaleOffset = transform.localScale - sourceScale; } } }