Animation Rigging 包可以在运行时为动画骨架启用程序化的运动,该示例项目演示了设置的工作流程步骤。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

65 行
1.9 KiB

using System.Collections.Generic;
using Unity.Collections;
namespace UnityEngine.Animations.Rigging
{
using Experimental.Animations;
[Unity.Burst.BurstCompile]
public struct TwistChainStep0Job : IWeightedAnimationJob
{
public NativeArray<ReadWriteTransformHandle> chain;
public ReadWriteTransformHandle rootTarget;
public ReadWriteTransformHandle tipTarget;
public FloatProperty jobWeight { get; set; }
public void ProcessRootMotion(AnimationStream stream) {}
public void ProcessAnimation(AnimationStream stream) {}
}
[System.Serializable]
public struct TwistChainStep0Data : IAnimationJobData
{
public Transform root;
public Transform tip;
[SyncSceneToStream] public Transform rootTarget;
[SyncSceneToStream] public Transform tipTarget;
bool IAnimationJobData.IsValid() => !(root == null || tip == null || !tip.IsChildOf(root) || rootTarget == null || tipTarget == null);
void IAnimationJobData.SetDefaultValues()
{
root = tip = rootTarget = tipTarget = null;
}
}
public class TwistChainStep0JobBinder : AnimationJobBinder<TwistChainStep0Job, TwistChainStep0Data>
{
public override TwistChainStep0Job Create(Animator animator, ref TwistChainStep0Data data, Component component)
{
// Build Job.
var job = new TwistChainStep0Job();
return job;
}
public override void Destroy(TwistChainStep0Job job)
{
}
public override void Update(TwistChainStep0Job job, ref TwistChainStep0Data data)
{
}
}
[DisallowMultipleComponent, AddComponentMenu("SIGGRAPH 2019/Twist Chain Step 0")]
public class TwistChainStep0 : RigConstraint<
TwistChainStep0Job,
TwistChainStep0Data,
TwistChainStep0JobBinder
>
{
}
}