|
|
|
|
|
|
public ReadWriteTransformHandle constrained; |
|
|
|
public ReadOnlyTransformHandle source; |
|
|
|
|
|
|
|
// Use Vector3BoolProperty to read in the axis booleans from
|
|
|
|
// the AnimationStream
|
|
|
|
public Vector3BoolProperty invert; |
|
|
|
|
|
|
|
public FloatProperty jobWeight { get; set; } |
|
|
|
|
|
|
if (w > 0f) |
|
|
|
{ |
|
|
|
var tmp = invert.Get(stream); |
|
|
|
float3 mask = new float3( |
|
|
|
float3 invertMask = new float3( |
|
|
|
math.select(1f, -1f, tmp.x), |
|
|
|
math.select(1f, -1f, tmp.y), |
|
|
|
math.select(1f, -1f, tmp.z) |
|
|
|
|
|
|
stream, |
|
|
|
math.lerp(constrained.GetPosition(stream), source.GetPosition(stream) * mask, w) |
|
|
|
math.lerp(constrained.GetPosition(stream), source.GetPosition(stream) * invertMask, w) |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
{ |
|
|
|
public Transform constrainedObject; |
|
|
|
[SyncSceneToStream] public Transform sourceObject; |
|
|
|
|
|
|
|
// Use SyncSceneToStream on Vector3Bool in order to add these
|
|
|
|
// properties to the AnimationStream and for them to be
|
|
|
|
// updated by the intial SyncSceneToStream job defined by the RigBuilder.
|
|
|
|
[SyncSceneToStream] public Vector3Bool invert; |
|
|
|
|
|
|
|
public bool IsValid() |
|
|
|
|
|
|
{ |
|
|
|
constrained = ReadWriteTransformHandle.Bind(animator, data.constrainedObject), |
|
|
|
source = ReadOnlyTransformHandle.Bind(animator, data.sourceObject), |
|
|
|
|
|
|
|
// Bind data.invert to job.invert so values can be resolved from the AnimationStream
|
|
|
|
invert = Vector3BoolProperty.Bind(animator, component, PropertyUtils.ConstructConstraintDataPropertyName(nameof(data.invert))) |
|
|
|
}; |
|
|
|
} |
|
|
|