public void UpdateOffsets(int driver)
        {
            driver = Mathf.Clamp(driver, 0, sources.Length - 1);

            int offset      = 0;
            var invDriverTx = sourceBindTx[driver].Inverse();

            for (int i = 0; i < sourceBindTx.Length; ++i)
            {
                if (i == driver)
                {
                    continue;
                }

                offsetTx[offset] = invDriverTx * sourceBindTx[i];
                offset++;
            }

            prevDriverIdx = driver;
        }
        public override MultiReferentialConstraintJob Create(Animator animator, ref T data, Component component)
        {
            var job = new MultiReferentialConstraintJob();

            var sources = data.sourceObjects;

            job.driver       = IntProperty.Bind(animator, component, data.driverIntProperty);
            job.sources      = new NativeArray <ReadWriteTransformHandle>(sources.Length, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
            job.sourceBindTx = new NativeArray <AffineTransform>(sources.Length, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
            job.offsetTx     = new NativeArray <AffineTransform>(sources.Length - 1, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);

            for (int i = 0; i < sources.Length; ++i)
            {
                job.sources[i]      = ReadWriteTransformHandle.Bind(animator, sources[i].transform);
                job.sourceBindTx[i] = new AffineTransform(sources[i].position, sources[i].rotation);
            }

            job.UpdateOffsets(data.driverValue);

            return(job);
        }