Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How Do I set a reference of two bone ik constraint

Hello, I am making a game and I added a a two bone IK constraint to my hand so it follows the gun. I want to change the weight of the two bone IK constraint so that it is 1 if the gun is being held and 0 if it isn't. something like this:

;public GameObject rig;
//set weight to the two bone ik constraint's weight 
if(holdingGun == true)
{
    weight = 1;
} else 
{
    weight = 0;
}

I know it seems simple but I can't find a way to get a reference to the two bone IK constraint, which is a component of the game object "rig" I tried using GetComponent<>() but i could not find a two bone IK constraint.

I want to set the two bone ik constraint's weight as a variable but I don't know how to get a reference

Sign In or Register to comment.