像这样的东西应该适用于获取当前的转换:
AnimationState state = animation["your_animation"];
state.enabled = true;
state.normalizedTime = (1.0f/totalAnimationTime) * specificFrame;
animation.Sample();
// get all transforms of this animation, extract your root and spine from here.
Transform[] transforms = animation.gameObject.GetComponentsInChildren<Transform>();
或者,如果您在动画运行时尝试采样,您可以执行以下操作:
if(animation["your_animation"].normalizedTime > 0.3 && animation["your_animation"].normalizedTime < 0.5) {
//... do something at this point in time. You'll have to figure out the frame
//from the time
}
最后我检查了你不能明确地提取一个特定的帧。但是,如果您知道动画的总长度(时间方面),您可以将动画移动到该点,例如:((1.0f/totalAnimationTime) * specificFrame;
假设关键帧是均匀间隔的。)
存储后,您应该可以直接修改转换,但我从未尝试过。