Experimental Animation Rigging Script
I am working on a method to do IK through script with non humanoid characters using the experimenttal rigging package and can't find the documentation containing the proper components class headings for the bone constraints, rig, or weight properties.
How are we accessing the weight property of the bone constraint components in script? It gives a NullReferenceException when weight is appended to the bonecomponent in the update. "TwoBoneIKConstraint.weight"
Start()
{
L_constraint = LFootControl.GetComponent<TwoBoneIKConstraint>();
R_constraint = LFootControl.GetComponent<TwoBoneIKConstraint>();
}
void Update()
{
TranformInverse(LeftFoot, LeftIKgoal, L_constraint.weight);
TranformInverse(RightFoot, RightIKgoal, R_constraint.weight);
}
private void TranformInverse(Transform Foot, Transform IKgoal, float weight)
{
Vector3 FootIKpos = transform.InverseTransformPoint(Foot.position);
Debug.Log(FootIKpos);
weight = 0;
if(FootIKpos.z > 0)
{
FeetPositionSolver(Foot, IKgoal);
weight = 1f;
}
}
Your answer
Follow this Question
Related Questions
Why does this work? 0 Answers
How to make your character lose limbs, either through physics or pre determined animation sequences? 0 Answers
Tweak HumanoidIdle animation? 0 Answers
Basic question: How to add new animation to my player ? 0 Answers
Unity Rigged Model parts not moving correctly / moving opposite directions with rig (Please Help!) 0 Answers