public override TwoBoneIKInverseConstraintJob Create(Animator animator, ref T data, Component component) { var job = new TwoBoneIKInverseConstraintJob(); job.root = ReadOnlyTransformHandle.Bind(animator, data.root); job.mid = ReadOnlyTransformHandle.Bind(animator, data.mid); job.tip = ReadOnlyTransformHandle.Bind(animator, data.tip); job.target = ReadWriteTransformHandle.Bind(animator, data.target); if (data.hint != null) { job.hint = ReadWriteTransformHandle.Bind(animator, data.hint); } job.targetOffset = AffineTransform.identity; if (data.maintainTargetPositionOffset) { job.targetOffset.translation = -(data.tip.position - data.target.position); } if (data.maintainTargetRotationOffset) { job.targetOffset.rotation = Quaternion.Inverse(data.tip.rotation) * data.target.rotation; } job.targetPositionWeight = FloatProperty.Bind(animator, component, data.targetPositionWeightFloatProperty); job.targetRotationWeight = FloatProperty.Bind(animator, component, data.targetRotationWeightFloatProperty); job.hintWeight = FloatProperty.Bind(animator, component, data.hintWeightFloatProperty); job.linkLengths[0] = Vector3.Distance(data.root.position, data.mid.position); job.linkLengths[1] = Vector3.Distance(data.mid.position, data.tip.position); return(job); }
public override void Destroy(TwoBoneIKInverseConstraintJob job) { }