Jinja

Hello,

I have some animations that rely upon animating a sequence of images to represent a projectile launch explosion. However, some of the frames are being skipped. Which frame goes missing will change with each playback, so it's not any particular frame that is failing, but it's always one frame that is missing.

The animator has tried two methods, enabling/disabling the assets in each slot, or animating the opacity to full/zero alpha. Both methods produce the same "missing frame" result.

The script that triggers the anim does so like this....

mSkeletonAnim.state.SetAnimation(0, animName, false);
mSkeletonAnim.state.AddAnimation(0, cIdleAnimName, true, 0.0f);

I've attached a gif that contains the attack animation being triggered every second or so. You can see that last frame sometimes contains a long laser line, but sometimes it shows a shorter laser line. Never the short followed by the long as intended.

You can also see that the frame rate is high enough that it shouldn't be dropping any frames. I've also slowed down the Time.timeScale to 0.1 but that doesn't fix the problem. It still drops frames.

Has anyone come across this missing frame problem?

Thanks for any help
Bu mesaja eklenen dosyaları görüntülemek için gerekli yetkilere sahip değilsiniz.
Jinja
  • Mesajlar: 5

OperationT

I've also experienced something similar, as described in my post here http://esotericsoftware.com/forum/Skipped-or-Missed-Key-Frames-5056?p=23693&hilit=skipped+frame#p23693.

In summary, my animation has two identical images for his sword. One is a child of his hand bone, so that he may wield it. One is a child of his torso, so that he may mount it. The reason for the need of two separate images is because Spine doesn't have dynamic re-parenting (yet?). My problem was that sometimes the frame, which enables visibility of one image and disables visibility of the other, misses (e.g. when he mounts his sword). 30 frames in Spine is 1 second, so each frame is 1/30 seconds. It would seem that as long as Unity is running at above 30 frames per second, no frame should be missed. But of course it's more complicated than that, but I don't know the reason behind the missing frame. My workaround was to add a few more frames that does the same thing (enable visibility of one image and disable visibility of the other). I no longer had the image visible when it's not supposed to be anymore.

Perhaps what you can try, before you find a better solution, is to duplicate your frames over several frames, then increase the playback speed of your animation by the same multiplier. E.g.: Your initial animation spans 10 frames. Now you duplicate every frame of the different stages of your laser image over the span of 4 frames, such that you end up with an animation that spans 40 frames. Then, in your animation state in Unity, set the Speed from the default of "1" to "4".

Sorry I don't have a solution that targets the root of the problem. I'm not certain that this will work either, but let me know how it goes if you plan to try it.
OperationT
  • Mesajlar: 12

Jinja

I've figured out what my problem was. I used the following code to trigger an attack and then go back to the idle...
mSkeletonAnim.state.SetAnimation(0, animName, false);
mSkeletonAnim.state.AddAnimation(0, cIdleAnimName, true, 0.0f);
If I removed the second line then the attack would play correctly. If I add the second line back then the attack would fail. I figured that the default behaviour must be trying to blend the two animations and is dropping important events. This seems like a bug to me but I can dodge the problem by avoiding the blend. So I now use the following code to trigger two anims without a blend...
mSkeletonAnim.state.Data.SetMix(animName, cIdleAnimName, 0.0f);
mSkeletonAnim.state.SetAnimation(0, animName, false);
mSkeletonAnim.state.AddAnimation(0, cIdleAnimName, true, 0.0f);
This works for my situation as I don't need to blend between animations. If you need to blend then there's still a bug to fix.
Jinja
  • Mesajlar: 5


Dön Unity