/// <inheritdoc /> public override BlendConstraintJob Create(Animator animator, ref T data, Component component) { var job = new BlendConstraintJob(); job.driven = ReadWriteTransformHandle.Bind(animator, data.constrainedObject); job.sourceA = ReadOnlyTransformHandle.Bind(animator, data.sourceObjectA); job.sourceB = ReadOnlyTransformHandle.Bind(animator, data.sourceObjectB); job.sourceAOffset = job.sourceBOffset = AffineTransform.identity; if (data.maintainPositionOffsets) { var drivenPos = data.constrainedObject.position; job.sourceAOffset.translation = drivenPos - data.sourceObjectA.position; job.sourceBOffset.translation = drivenPos - data.sourceObjectB.position; } if (data.maintainRotationOffsets) { var drivenRot = data.constrainedObject.rotation; job.sourceAOffset.rotation = Quaternion.Inverse(data.sourceObjectA.rotation) * drivenRot; job.sourceBOffset.rotation = Quaternion.Inverse(data.sourceObjectB.rotation) * drivenRot; } job.blendPosition = BoolProperty.Bind(animator, component, data.blendPositionBoolProperty); job.blendRotation = BoolProperty.Bind(animator, component, data.blendRotationBoolProperty); job.positionWeight = FloatProperty.Bind(animator, component, data.positionWeightFloatProperty); job.rotationWeight = FloatProperty.Bind(animator, component, data.rotationWeightFloatProperty); return(job); }
/// <inheritdoc /> public override void Destroy(BlendConstraintJob job) { }