浏览代码

Fixed root motion

Added boolean to specify allow root motion, which either locks a model in place, or allows then to move to new positions/rotations due to animation
/main
Steven Borkman 4 年前
当前提交
3142805f
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 2
      com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Randomizers/AnimationRandomizer.cs
  2. 6
      com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Tags/AnimationRandomizerTag.cs

2
com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Randomizers/AnimationRandomizer.cs


var cachedData = new CachedData { graph = PlayableGraph.Create() };
cachedData.graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
var animator = tag.gameObject.GetComponent<Animator>();
animator.applyRootMotion = tag.applyRootMotion;
cachedData.output = AnimationPlayableOutput.Create(cachedData.graph, "Animation", animator);
for (var i = 0; i < tag.animationClips.GetCategoryCount(); i++)

6
com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Tags/AnimationRandomizerTag.cs


/// </summary>
public AnimationClipParameter animationClips;
/// <summary>
/// Apply the root motion to the animator. If true, if an animation has a rotation translation and/or rotation
/// that will be applied to the labeled model, which means that the model maybe move to a new position.
/// If false, then the model will stay at its current position/rotation.
/// </summary>
public bool applyRootMotion = false;
}
}
正在加载...
取消
保存