Search Unity

Question How to use an instantiated target transform in TwoBoneIk Animation Rigging?

Discussion in 'Animation Rigging' started by sovtek, Apr 10, 2021.

  1. sovtek

    sovtek

    Joined:
    Oct 8, 2019
    Posts:
    9
    So, Animation Rigging is really cool and there are all these great videos showing us how you can use it with an existing attached game object such as a weapon, but I cannot find any information on how to use an instantiated object as a target. I can't imagine there are too many successful games that would only allow a player to have a single object that's always available, so there must be some trick to this. So.... how do you set the IK target of a rig if your object doesn't exist until after runtime?

    I've tried the following

    Code (CSharp):
    1. RightHandIk.data.target = rod.RodIKPoint.transform;
    2. LeftHandIk.data.target = rod.ReelIKPoint.transform;