浏览代码

Add final copy location constraint with scene

/main
Olivier Dionne 5 年前
当前提交
7ef2d3f5
共有 4 个文件被更改,包括 1024 次插入4 次删除
  1. 18
      Assets/Constraints/CopyLocation.cs
  2. 2
      Assets/Constraints/CopyLocation.cs.meta
  3. 1001
      Assets/Scenes/CopyLocationFinal.unity
  4. 7
      Assets/Scenes/CopyLocationFinal.unity.meta

18
Assets/Constraints/CopyLocation.cs


{
public ReadWriteTransformHandle constrained;
public ReadOnlyTransformHandle source;
public float3 invert;
public BoolProperty xInvert;
public BoolProperty yInvert;
public BoolProperty zInvert;
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))
);
math.lerp(constrained.GetPosition(stream), source.GetPosition(stream) * invert, w)
math.lerp(constrained.GetPosition(stream), source.GetPosition(stream) * invertMask, w)
);
}
}

{
constrained = ReadWriteTransformHandle.Bind(animator, data.constrainedObject),
source = ReadOnlyTransformHandle.Bind(animator, data.sourceObject),
invert = new float3(data.xInvert ? -1f : 1f, data.yInvert ? -1f : 1f, data.zInvert ? -1f: 1f)
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)))
};
}

2
Assets/Constraints/CopyLocation.cs.meta


fileFormatVersion: 2
guid: 500a29b409189a5449ac7b3fe6d98a88
guid: d3d4cc49e730d334ba57c844fa0a5e6c
MonoImporter:
externalObjects: {}
serializedVersion: 2

1001
Assets/Scenes/CopyLocationFinal.unity
文件差异内容过多而无法显示
查看文件

7
Assets/Scenes/CopyLocationFinal.unity.meta


fileFormatVersion: 2
guid: 0d1c9e7fe5bce9c40ad385ecd4cc880d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存