two bone ik constraint not working

Hello, i have a gun with ik target that is attached to the two bone ik constraint target at run time by this script:

 public TwoBoneIKConstraint rightHand;
    public GameObject makarov;
    // Start is called before the first frame update
    void Start()
    {
        if(!IsOwner) { return; }
    }

    // Update is called once per frame
    void Update()
    {
        if (!IsOwner) { return; }

        if (makarov.activeSelf)
        {
            Debug.Log("tttt");
            rightHand.data.target = makarov.transform.Find("RIghtHandIK");

        }
    }

but the arm doesnt follow the target:

(vid starts at 0:23 seconds)

SOLVED:
add: RigBuilder.Build(); after changing the IK target in script

1 Like

This is not the thing I’m looking for. But, for future people, it’s much more efficient and easier to have a target always assigned to the two bone constraint and then just move the target in the code instead of changing the actual target.

1 Like