|
|
|
|
|
|
public ReadWriteTransformHandle constrained; |
|
|
|
public ReadOnlyTransformHandle source; |
|
|
|
|
|
|
|
public BoolProperty xInvert; |
|
|
|
public BoolProperty yInvert; |
|
|
|
public BoolProperty zInvert; |
|
|
|
public Vector3BoolProperty invert; |
|
|
|
|
|
|
|
public FloatProperty jobWeight { get; set; } |
|
|
|
|
|
|
|
|
|
|
float w = jobWeight.Get(stream); |
|
|
|
if (w > 0f) |
|
|
|
{ |
|
|
|
float3 invertMask = new float3( |
|
|
|
math.select(1f, -1f, xInvert.Get(stream)), |
|
|
|
math.select(1f, -1f, yInvert.Get(stream)), |
|
|
|
math.select(1f, -1f, zInvert.Get(stream)) |
|
|
|
var tmp = invert.Get(stream); |
|
|
|
float3 mask = new float3( |
|
|
|
math.select(1f, -1f, tmp.x), |
|
|
|
math.select(1f, -1f, tmp.y), |
|
|
|
math.select(1f, -1f, tmp.z) |
|
|
|
math.lerp(constrained.GetPosition(stream), source.GetPosition(stream) * invertMask, w) |
|
|
|
math.lerp(constrained.GetPosition(stream), source.GetPosition(stream) * mask, w) |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
{ |
|
|
|
public Transform constrainedObject; |
|
|
|
[SyncSceneToStream] public Transform sourceObject; |
|
|
|
[SyncSceneToStream] public bool xInvert; |
|
|
|
[SyncSceneToStream] public bool yInvert; |
|
|
|
[SyncSceneToStream] public bool zInvert; |
|
|
|
[SyncSceneToStream] public Vector3Bool invert; |
|
|
|
|
|
|
|
public bool IsValid() |
|
|
|
{ |
|
|
|
|
|
|
{ |
|
|
|
constrainedObject = null; |
|
|
|
sourceObject = null; |
|
|
|
xInvert = yInvert = zInvert = false; |
|
|
|
invert = new Vector3Bool(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
constrained = ReadWriteTransformHandle.Bind(animator, data.constrainedObject), |
|
|
|
source = ReadOnlyTransformHandle.Bind(animator, data.sourceObject), |
|
|
|
|
|
|
|
xInvert = BoolProperty.Bind(animator, component, PropertyUtils.ConstructConstraintDataPropertyName(nameof(data.xInvert))), |
|
|
|
yInvert = BoolProperty.Bind(animator, component, PropertyUtils.ConstructConstraintDataPropertyName(nameof(data.yInvert))), |
|
|
|
zInvert = BoolProperty.Bind(animator, component, PropertyUtils.ConstructConstraintDataPropertyName(nameof(data.zInvert))) |
|
|
|
invert = Vector3BoolProperty.Bind(animator, component, PropertyUtils.ConstructConstraintDataPropertyName(nameof(data.invert))) |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|