unity – When the object that move to the target is not in chasing mode the magnitude os it’s position is over 28 how can I resolve it?

using Cinemachine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveToTarget : MonoBehaviour
{
    public enum TransitionState
    {
        None,
        MovingTowards,
        Transferring
    }

    public Transform transformToChildTarget;
    public Transform transformChasingTarget;
    public bool isChild = false;
    public AnimationCurve curve = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, 1.0f);
    public float duration = 10.0f;
    public GameObject mainCam;
    public CinemachineFreeLook freeLookCamGameplay;
    public CinemachineFreeLook freeLookCamPickUp;
    public UnlockCrate unlockCrate;
    public InteractableItem interactableItem;
    public IKControl ikControl;
    public Transform player;
    public bool isChasing = false;

    private float t;
    private Transform originTransform;
    private float timer;
    private TransitionState state = TransitionState.MovingTowards;
    private Vector3 originPosition;
    private bool enableInteractableItemOnce = false;
    Vector3 v;

    void Start()
    {
        t = 0.0f;

        curve.postWrapMode = WrapMode.Once;
        originPosition = transform.position;
    }

    void Update()
    {
        if (unlockCrate.HasOpened())
        {
            if (enableInteractableItemOnce == false)
            {
                interactableItem.enabled = true;

                enableInteractableItemOnce = true;
            }

            if (isChasing)
            {
                originTransform = transformChasingTarget;
            }

            switch (state)
            {
                case TransitionState.MovingTowards:
                    if (isChasing)
                    {
                        v = transformChasingTarget.position - transform.position;
                    }
                    else
                    {
                        v = transformToChildTarget.position;
                    }
                    if (v.magnitude < 0.001f)
                    {
                        SwitchCameras();

                        state = TransitionState.Transferring;
                        if (isChasing)
                        {
                            originTransform = transformChasingTarget;
                        }
                        else
                        {
                            originTransform = transformToChildTarget;
                        }
                        timer = 0;
                        return;
                    }

                    t += Time.deltaTime;
                    float s = t / duration;

                    if (isChasing)
                    {
                        transform.position = Vector3.Lerp(originPosition,
                            transformChasingTarget.position, curve.Evaluate(s));
                    }
                    else
                    {
                        transform.position = Vector3.Lerp(originPosition,
                            transformToChildTarget.position, curve.Evaluate(s));
                    }

                    break;

                case TransitionState.Transferring:
                    timer += Time.deltaTime;
                    this.transform.position = Vector3.Lerp(originTransform.position, transformToChildTarget.position, timer);
                    if (timer >= 1.0f)
                    {
                        this.transform.parent = transformToChildTarget;
                        transform.localPosition = new Vector3(0, 0, 0);
                        isChild = true;
                        interactableItem.distance = 0;

                        state = TransitionState.None;
                        this.enabled = false;
                        return;
                    }
                    break;

                default:
                    this.enabled = false;
                    return;
            }
        }
    }

    private void SwitchCameras()
    {
        var brain = mainCam.GetComponent<CinemachineBrain>();
        brain.m_DefaultBlend.m_Time = 1f;
        freeLookCamGameplay.enabled = true;
        freeLookCamPickUp.enabled = false;
    }
}

When the flag isChasing is set to false the object transformToChildTarget is moving to a target and become a child of this target. In this case the fingers on the player right hand.

Maybe the problem is that the hand as target is too close to the player so when the object move to it and get to it the magnitude is too high ?

When the flag isChasing is true and than the object in transformChasingTarget is moving to the target and I move the player around drag the player around the object transformChasingTarget is chasing the player until it’s reaching the player and than become the player hand child and it’s continue to do the code after the magnitude checking line :

if (v.magnitude < 0.001f)

But if it’s not in chasing mode the player is not moving at all the object become the player hand child but the magnitude is very high : over 28.

I’m not sure what is wrong and how to solve it ?