With 3D animation, you have the luxury of animation events. With Paper2D, there seems to be no good way of knowing what frame of animation you are on, and the float playback position misses frames. Essentially, we are working on a fighting game, where it is very important to know what frame of animation the character is on. Grabbing the frame through rough maths or just grabbing the raw position doesn’t work. It seems to miss sometimes. Is there a reliable way to trigger animation events for Paper2D?
There is no support for anim notify tracks on flipbook animations right now, but getting the current time position and # of frames should work reliably. It is the same time used to render the flipbook. However, you cannot assume that between two ticks at most one frame will be passed, you have to account for that in your code.
For example, say frame N has time = 0.5, but you get a hitch due to something else running on the user’s system, and the next frame has a time of 0.9. You can’t just check to see if any events happened at frame 0.9, you need to check the timespan between 0.5 and 0.9 and process all events in between. This is also true for looping animations: if in the same case the animation was of length 0.7, you’d need to check both 0.5 to 0.7 and 0.0 to 0.2 for events you want to fire.
I dont think that the OP had a problem figuring this out(forgive me if i am mistaken).I believe it was more of a why we do not have animation notifications yet. Dont get me wrong we highly value the fact that you read our posts and you are always there to help us out but this answer is just a workaround.
Personally i do not have consistent results with the method described above. It works ~90% of the time but not always.Especially if you have 30-40-50 frames per flipbook. Another big problem that i am facing without notifies is with SFX. I am forced to create looping walking cycles that have the exact length of the flipbook. But if i want to speed up the animation (for example running) i have to create another looping SFX in order for it to play synchronized . That is both time consuming and inefficient .
May i ask why we paper2d guys miss out on such basic functionality that could help us improve dramatically our workflow?
Hey there, I appreciate the feedback, but I am not sure why this solution is not working. Let me show you what we have.
Get Image Index (For getting the current frame of animation.)
Set Image Index (For setting the animation to a specific frame of animation.)
This is not working, as detecting a certain frame of animation is nearly impossible to do 100% of the time.
Edit: As this is a 2D fighting game, working with frames is essential.
Essentially, for a working 2D development system, we need a way to consistently and accurately know/set the frame we are on. Since it is a fighting game, we can not have frame skips, it just can’t happen. Right now, I can’t even safely determine when we’ve reached the end of the animation unless I disable looping, and that messes up a host of other things. Imagine trying to generate hurtboxes or stun frames.
I feel you buddy! I have the exact same problems as you .Anyone that develops anything more than tappy chicken will eventually face the same roadblocks as we do. Lets hope that they soon realize that if they want us to create some cool 2d games with unreal then we need all the support we can get.
Why dont you use a spriter or Spine to import your hitboxes? That would work (trolling level 1000)!
Hey, joking aside, the new frame based collision for flipbooks works perfectly for hitboxes. I made a custom channel and now we can draw in multi-polygon hitboxes.
Put simply, without a solution to this our project on Unreal is screwed. There HAS to be a solution, since we have access to the source. I wonder if there are any savy programmers here that would chime in.
I will tell you what i did to solve the above problem but in your case i dont think it is something you want to do. I divided all my animations into parts so i could get from “on animation end” the precision i wanted. So what you basically do is to play animation 1 set is as not lopping,then when on animation ends do what you want and then set looping ,set animation 2 ,play animation.
You will end up with a blueprint that is a mess but at least it works.Not to mention all the work you have to do to split and import all the chopped animations.
I had a feeling it would be something like that, and that would work for crouching/jumping/ect, but when it comes to frame based generation like particle effects and hitboxes, that is a whole new story.
So is this still not a thing?