namespace Zinnia.Tracking.Follow.Modifier.Property.Scale { using UnityEngine; using Zinnia.Extension; /// /// Updates the transform scale of the target to match the source. /// public class TransformScale : SmoothedRestrictableTransformPropertyModifier { /// /// Modifies the target scale to match the given source scale. /// /// The source to utilize in the modification. /// The target to modify. /// The offset of the target against the source when modifying. protected override void DoModify(GameObject source, GameObject target, GameObject offset = null) { SaveOriginalPropertyValue(target.transform.lossyScale); Vector3 targetScale = offset == null ? source.transform.lossyScale : source.transform.lossyScale.Divide(offset.transform.localScale); target.transform.SetGlobalScale(Smooth(target.transform.lossyScale, targetScale)); if (HasAxisRestrictions) { target.transform.SetGlobalScale(RestrictPropertyValue(target.transform.lossyScale)); } } } }