Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question two bone ik constraint not working

Discussion in 'Animation Rigging' started by cesar121321432, Aug 13, 2023.

  1. cesar121321432

    cesar121321432

    Joined:
    Jul 11, 2020
    Posts:
    20
    Hello, i have a gun with ik target that is attached to the two bone ik constraint target at run time by this script:
    Code (CSharp):
    1.  public TwoBoneIKConstraint rightHand;
    2.     public GameObject makarov;
    3.     // Start is called before the first frame update
    4.     void Start()
    5.     {
    6.         if(!IsOwner) { return; }
    7.     }
    8.  
    9.     // Update is called once per frame
    10.     void Update()
    11.     {
    12.         if (!IsOwner) { return; }
    13.  
    14.         if (makarov.activeSelf)
    15.         {
    16.             Debug.Log("tttt");
    17.             rightHand.data.target = makarov.transform.Find("RIghtHandIK");
    18.  
    19.         }
    20.     }
    but the arm doesnt follow the target:


    (vid starts at 0:23 seconds)
     
  2. cesar121321432

    cesar121321432

    Joined:
    Jul 11, 2020
    Posts:
    20
    SOLVED:
    add:
    Code (CSharp):
    1. RigBuilder.Build();
    after changing the IK target in script