namespace Zinnia.Tracking.Follow.Modifier.Property.Position { using UnityEngine; /// /// Updates the transform position of the target to match the source. /// public class TransformPosition : SmoothedRestrictableTransformPropertyModifier { /// /// Modifies the target position to match the given source position. /// /// 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.position); Vector3 targetPosition = offset == null ? source.transform.position : source.transform.position - (offset.transform.position - target.transform.position); target.transform.position = Smooth(target.transform.position, targetPosition); if (HasAxisRestrictions) { target.transform.position = RestrictPropertyValue(target.transform.position); } } } }