public override PBDBonesJob Create(Animator animator, ref T data, Component component)
        {
            var job = new PBDBonesJob {
                boneChain      = new NativeArray <ReadWriteTransformHandle>(data.BoneChain.Length, Allocator.Persistent),
                restLengths    = new NativeArray <float>(data.BoneChain.Length - 1, Allocator.Persistent),
                tipTarget      = ReadOnlyTransformHandle.Bind(animator, data.TipTarget),
                minimumHeight  = data.MinimumHeight,
                iterationCount = data.IterationCount
            };

            for (var i = 0; i < data.BoneChain.Length; i++)
            {
                job.boneChain[i] = ReadWriteTransformHandle.Bind(animator, data.BoneChain[i]);
            }
            for (var i = 0; i < data.BoneChain.Length - 1; i++)
            {
                job.restLengths[i] = distance(data.BoneChain[i].position, data.BoneChain[i + 1].position);
            }
            return(job);
        }
 public override void Destroy(PBDBonesJob job)
 {
     job.boneChain.Dispose();
     job.restLengths.Dispose();
 }