public void ProcessAnimation(AnimationStream stream) { float w = jobWeight.Get(stream); if (w > 0f) { AnimationRuntimeUtils.SolveTwoBoneIK( stream, root, mid, tip, target, hint, targetPositionWeight.Get(stream) * w, targetRotationWeight.Get(stream) * w, hintWeight.Get(stream) * w, targetOffset ); } else { AnimationRuntimeUtils.PassThrough(stream, root); AnimationRuntimeUtils.PassThrough(stream, mid); AnimationRuntimeUtils.PassThrough(stream, tip); } }
public void ProcessAnimation(AnimationStream stream) { float w = jobWeight.Get(stream); var sliderPos = Slider.GetLocalPosition(stream); var t = Mathf.Clamp01(sliderPos.y); Slider.SetLocalPosition(stream, new Vector3(0, t, 0)); if (w > 0f) { var rootRot = Root.GetRotation(stream); var midRot = Mid.GetRotation(stream); var tipRot = Tip.GetRotation(stream); var rootRotFK = Quaternion.Lerp(rootRot, FK_Root.GetRotation(stream), w); var midRotFK = Quaternion.Lerp(midRot, FK_Mid.GetRotation(stream), w); var tipRotFK = tipRot; AnimationRuntimeUtils.SolveTwoBoneIK( stream, Root, Mid, Tip, IK_Target, IK_Hint, posWeight: 1f * w, rotWeight: 0 * w, hintWeight: 1f * w, limbLengths: LinkLengths, targetOffset: AffineTransform.identity ); var rootRotIK = Root.GetRotation(stream); var midRotIK = Mid.GetRotation(stream); var tipRotIK = Tip.GetRotation(stream); Root.SetRotation(stream, Quaternion.Lerp(rootRotFK, rootRotIK, t)); Mid.SetRotation(stream, Quaternion.Lerp(midRotFK, midRotIK, t)); Tip.SetRotation(stream, Quaternion.Lerp(tipRotFK, tipRotIK, t)); } }