关于问题(1):
平滑的骨骼动画永远无法预测样本帧的确切位置。这是一个理论问题,并非特定于 Spine 或 spin-unity。
如果你需要精确的方向,比如水平向前发射一个粒子,那么你需要调整你的脚本,让它总是向前发射粒子,它不依赖于动画。您仍然可以通过 Spine 事件触发此类事件,但不要让方向依赖于它。
关于问题(2):
您可以通过禁用 SkeletonAnimation
组件来增加更新计数,并在每个显示的帧中更频繁地手动调用 skeletonAnimtion.Update(deltaTime)
。然后您需要相应地调整传递的 deltaTime
参数。如果例如你调用 skeletonAnimation.Update(deltaTime)
的频率是三倍,那么每个单独的 deltaTime
将大约是原始 deltaTime
的三分之一。您可以查看示例场景“Spine Examples/Other Examples/FixedTimestepUpdates”,它以类似的方式控制更新,反之亦然,降低播放帧速率而不是增加它。
不过,我们不建议每帧多次调用 skeletonAnimation.Update(deltaTime)
来解决您的问题。您可以改为调整多边形轨迹实现以更平滑地插入轨迹的角点(以共同创建更平滑的网格)。另请注意,如果多边形轨迹不能提供平滑任何角落的方法,它们看起来总是有点锯齿状。作为替代方案,您也可以不使用多边形轨迹,而是使用一个或多个显示完美圆形轨迹的图像,然后将它们淡入并根据动画缩放它们以创建类似的效果。
Regarding problem (1):
Smooth skeletal animation is never predictable in regards of where exactly your sample frames will land. This is a theoretical problem, not specific to Spine or spine-unity.
If you need precise direction, like firing a particle horizontally forward, then you need to adjust your script so that it always fires the particles forward, it shall not depend on the animation. You could still trigger such an event by a Spine event, but not let the direction depend on it.
Regarding problem (2):
You could increase the update count by disabling the SkeletonAnimation
component and call skeletonAnimtion.Update(deltaTime)
manually more often than once per displayed frame. Then you need to adjust the passed deltaTime
parameter accordingly. If e.g. you call skeletonAnimation.Update(deltaTime)
three times as often, each individual deltaTime
would then be approximately one third of the original deltaTime
. You could check out the example scene Spine Examples/Other Examples/FixedTimestepUpdates
which controls updates in a similar way, just the other way around, lowering the playback framerate instead of increasing it.
Nevertheless, we would not recommend to call skeletonAnimation.Update(deltaTime)
more than once per frame to solve your problem. You could instead either adjust the polygonal trail implementation to more smoothly interpolate the trail's corner points (to create a smoother mesh alltogether). Please also note that polygonal trails always look a bit jagged, if they don't provide a way for smoothing any corners. As an alternative you could also not use a polygonal trail but instead use one or multiple images that show a perfectly round trail and then fade them in and scale them according to the animation to create a similar effect.